Skip to content

Commit

Permalink
Merge pull request #868 from Unidata/gh849.wif
Browse files Browse the repository at this point in the history
Pull #849 plus a note in the release notes.
  • Loading branch information
WardF authored Feb 16, 2018
2 parents 3f035d9 + a3ea416 commit db41b2a
Show file tree
Hide file tree
Showing 28 changed files with 2,289 additions and 655 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ ENDIF()
###

# Option to use HDF4
OPTION(ENABLE_HDF4 "Build netCDF-4 with HDF5 read capability(HDF4, HDF5 and Zlib required)." OFF)
OPTION(ENABLE_HDF4 "Build netCDF-4 with HDF4 read capability(HDF4, HDF5 and Zlib required)." OFF)
IF(ENABLE_HDF4)
SET(USE_HDF4 ON)
# Check for include files, libraries.
Expand Down Expand Up @@ -526,6 +526,11 @@ IF(ENABLE_NETCDF_4)
SET(USE_NETCDF4 ON CACHE BOOL "")
SET(ENABLE_NETCDF_4 ON CACHE BOOL "")
SET(ENABLE_NETCDF4 ON CACHE BOOL "")
ELSE()
SET(USE_HDF4_FILE_TESTS OFF)
SET(USE_HDF4 OFF)
SET(ENABLE_HDF4_FILE_TESTS OFF)
SET(ENABLE_HDF4 OFF)
ENDIF()

# Option to allow for strict null file padding.
Expand Down Expand Up @@ -1609,6 +1614,10 @@ IF(USE_HDF5)
add_subdirectory(libsrc4)
ENDIF(USE_HDF5)

IF(USE_HDF4)
add_subdirectory(libhdf4)
ENDIF(USE_HDF4)

IF(ENABLE_DAP2)
ADD_SUBDIRECTORY(oc2)
ADD_SUBDIRECTORY(libdap2)
Expand Down
9 changes: 7 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ if USE_PNETCDF
LIBSRCP = libsrcp
endif

# Build HDF4 if desired.
if USE_HDF4
LIBHDF4 = libhdf4
endif

# Define Test directories
if BUILD_TESTSETS
TESTDIRS = $(V2_TEST) nc_test $(NC_TEST4) $(NCDAP2TESTDIR) \
Expand All @@ -72,8 +77,8 @@ endif
# and run. ncgen must come before ncdump, because their tests
# depend on it.
SUBDIRS = include $(H5_TEST_DIR) libdispatch libsrc $(LIBSRC4_DIR) \
$(LIBSRCP) $(OCLIB) $(DAP2) ${DAP4} liblib $(NCGEN3) $(NCGEN) \
$(NCDUMP) $(TESTDIRS) docs $(EXAMPLES)
$(LIBSRCP) $(LIBHDF4) $(OCLIB) $(DAP2) ${DAP4} liblib $(NCGEN3) \
$(NCGEN) $(NCDUMP) $(TESTDIRS) docs $(EXAMPLES)

# Remove these generated files, for a distclean.
DISTCLEANFILES = VERSION comps.txt test_prog libnetcdf.settings \
Expand Down
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This file contains a high-level description of this package's evolution. Release
## 4.6.1 - TBD

* [Bug Fix] Improved support for CRT builds with Visual Studio, improves zlib detection in hdf5 library. See [Github #853](https://github.com/Unidata/netcdf-c/pull/853) for more information.
* [Enhancement][Internal] Moved HDF4 into a distinct dispatch layer. See [Github #849](https://github.com/Unidata/netcdf-c/pull/849) for more information.

## 4.6.0 - January 24, 2018
* [Enhancement] Full support for using HDF5 dynamic filters, both for reading and writing. See the file docs/filters.md.
Expand Down
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ AC_MSG_CHECKING([whether reading of HDF4 SD files is to be enabled])
AC_ARG_ENABLE([hdf4], [AS_HELP_STRING([--enable-hdf4],
[build netcdf-4 with HDF4 read capability (HDF4, HDF5 and zlib required)])])
test "x$enable_hdf4" = xyes || enable_hdf4=no
if test "x$enable_hdf4" = xyes -a "x$enable_netcdf_4" = xno; then
AC_MSG_ERROR([NetCDF-4 is required for HDF4 features])
fi
AC_MSG_RESULT($enable_hdf4)

# Does the user want to turn on extra HDF4 file tests?
Expand Down Expand Up @@ -1447,6 +1450,7 @@ AC_CONFIG_FILES([Makefile
oc2/Makefile
libdap2/Makefile
libdap4/Makefile
libhdf4/Makefile
libdispatch/Makefile
liblib/Makefile
ncdump/cdl/Makefile
Expand Down
14 changes: 8 additions & 6 deletions include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# This automake file generates the Makefile to build the include
# directory.

# Ed Hartnett, Dennis Heimbigner, Ward Fisher

include_HEADERS = netcdf.h netcdf_meta.h

if BUILD_PARALLEL
Expand All @@ -14,12 +16,12 @@ if BUILD_DISKLESS
include_HEADERS += netcdf_mem.h
endif

noinst_HEADERS = nc_logging.h nc_tests.h fbits.h nc.h \
nclist.h ncuri.h ncutf8.h ncdispatch.h ncdimscale.h \
netcdf_f.h err_macros.h ncbytes.h nchashmap.h ceconstraints.h rnd.h \
nclog.h ncconfigure.h nc4internal.h nctime.h nc3internal.h \
onstack.h nc_hashmap.h ncrc.h ncauth.h ncoffsets.h nctestserver.h \
nc4dispatch.h nc3dispatch.h ncexternl.h ncwinpath.h ncfilter.h
noinst_HEADERS = nc_logging.h nc_tests.h fbits.h nc.h nclist.h \
ncuri.h ncutf8.h ncdispatch.h ncdimscale.h netcdf_f.h err_macros.h \
ncbytes.h nchashmap.h ceconstraints.h rnd.h nclog.h ncconfigure.h \
nc4internal.h nctime.h nc3internal.h onstack.h nc_hashmap.h ncrc.h \
ncauth.h ncoffsets.h nctestserver.h nc4dispatch.h nc3dispatch.h \
ncexternl.h ncwinpath.h ncfilter.h hdf4dispatch.h

if USE_DAP
noinst_HEADERS += ncdap.h
Expand Down
276 changes: 276 additions & 0 deletions include/hdf4dispatch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
/* Copyright 2018, UCAR/Unidata. See netcdf/COPYRIGHT file for copying
* and redistribution conditions. */
/**
* @file
* This header file contains the prototypes for the HDF4 versions
* of the netCDF functions.
*
* Ed Hartnett
*/
#ifndef _HDF4DISPATCH_H
#define _HDF4DISPATCH_H

#include "config.h"
#include <stddef.h> /* size_t, ptrdiff_t */
#include <errno.h> /* netcdf functions sometimes return system errors */
#include "ncdispatch.h"

#if defined(__cplusplus)
extern "C" {
#endif

extern int
HDF4_create(const char *path, int cmode,
size_t initialsz, int basepe, size_t *chunksizehintp,
int useparallel, void* parameters,
NC_Dispatch*, NC*);

extern int
HDF4_open(const char *path, int mode,
int basepe, size_t *chunksizehintp,
int use_parallel, void* parameters,
NC_Dispatch*, NC*);

extern int
HDF4_redef(int ncid);

extern int
HDF4__enddef(int ncid, size_t h_minfree, size_t v_align,
size_t v_minfree, size_t r_align);

extern int
HDF4_sync(int ncid);

extern int
HDF4_abort(int ncid);

extern int
HDF4_close(int ncid);

extern int
HDF4_set_fill(int ncid, int fillmode, int *old_modep);

extern int
HDF4_set_base_pe(int ncid, int pe);

extern int
HDF4_inq_base_pe(int ncid, int *pe);

extern int
HDF4_inq_format(int ncid, int *formatp);

extern int
HDF4_inq_format_extended(int ncid, int *formatp, int *modep);

extern int
HDF4_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp);

extern int
HDF4_inq_type(int, nc_type, char *, size_t *);

/* Begin _dim */

extern int
HDF4_def_dim(int ncid, const char *name, size_t len, int *idp);

extern int
HDF4_inq_dimid(int ncid, const char *name, int *idp);

extern int
HDF4_inq_dim(int ncid, int dimid, char *name, size_t *lenp);

extern int
HDF4_inq_unlimdim(int ncid, int *unlimdimidp);

extern int
HDF4_rename_dim(int ncid, int dimid, const char *name);

/* End _dim */
/* Begin _att */

extern int
HDF4_inq_att(int ncid, int varid, const char *name,
nc_type *xtypep, size_t *lenp);

extern int
HDF4_inq_attid(int ncid, int varid, const char *name, int *idp);

extern int
HDF4_inq_attname(int ncid, int varid, int attnum, char *name);

extern int
HDF4_rename_att(int ncid, int varid, const char *name, const char *newname);

extern int
HDF4_del_att(int ncid, int varid, const char*);

/* End _att */
/* Begin {put,get}_att */

extern int
HDF4_get_att(int ncid, int varid, const char *name, void *value, nc_type);

extern int
HDF4_put_att(int ncid, int varid, const char *name, nc_type datatype,
size_t len, const void *value, nc_type);

/* End {put,get}_att */
/* Begin _var */

extern int
HDF4_def_var(int ncid, const char *name,
nc_type xtype, int ndims, const int *dimidsp, int *varidp);

extern int
HDF4_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
int *ndimsp, int *dimidsp, int *nattsp,
int *shufflep, int *deflatep, int *deflate_levelp,
int *fletcher32p, int *contiguousp, size_t *chunksizesp,
int *no_fill, void *fill_valuep, int *endiannessp,
unsigned int* idp, size_t* nparamsp, unsigned int* params
);

extern int
HDF4_inq_varid(int ncid, const char *name, int *varidp);

extern int
HDF4_rename_var(int ncid, int varid, const char *name);

extern int
HDF4_put_vara(int ncid, int varid,
const size_t *start, const size_t *count,
const void *value, nc_type);

extern int
HDF4_get_vara(int ncid, int varid,
const size_t *start, const size_t *count,
void *value, nc_type);

/* End _var */

/* netCDF4 API only */
extern int
HDF4_var_par_access(int, int, int);

extern int
HDF4_inq_ncid(int, const char *, int *);

extern int
HDF4_inq_grps(int, int *, int *);

extern int
HDF4_inq_grpname(int, char *);

extern int
HDF4_inq_grpname_full(int, size_t *, char *);

extern int
HDF4_inq_grp_parent(int, int *);

extern int
HDF4_inq_grp_full_ncid(int, const char *, int *);

extern int
HDF4_inq_varids(int, int * nvars, int *);

extern int
HDF4_inq_dimids(int, int * ndims, int *, int);

extern int
HDF4_inq_typeids(int, int * ntypes, int *);

extern int
HDF4_inq_type_equal(int, nc_type, int, nc_type, int *);

extern int
HDF4_def_grp(int, const char *, int *);

extern int
HDF4_rename_grp(int, const char *);

extern int
HDF4_inq_user_type(int, nc_type, char *, size_t *, nc_type *,
size_t *, int *);

extern int
HDF4_def_compound(int, size_t, const char *, nc_type *);

extern int
HDF4_insert_compound(int, nc_type, const char *, size_t, nc_type);

extern int
HDF4_insert_array_compound(int, nc_type, const char *, size_t,
nc_type, int, const int *);

extern int
HDF4_inq_typeid(int, const char *, nc_type *);

extern int
HDF4_inq_compound_field(int, nc_type, int, char *, size_t *,
nc_type *, int *, int *);

extern int
HDF4_inq_compound_fieldindex(int, nc_type, const char *, int *);

extern int
HDF4_def_vlen(int, const char *, nc_type base_typeid, nc_type *);

extern int
HDF4_put_vlen_element(int, int, void *, size_t, const void *);

extern int
HDF4_get_vlen_element(int, int, const void *, size_t *, void *);

extern int
HDF4_def_enum(int, nc_type, const char *, nc_type *);

extern int
HDF4_insert_enum(int, nc_type, const char *, const void *);

extern int
HDF4_inq_enum_member(int, nc_type, int, char *, void *);

extern int
HDF4_inq_enum_ident(int, nc_type, long long, char *);

extern int
HDF4_def_opaque(int, size_t, const char *, nc_type *);

extern int
HDF4_def_var_deflate(int, int, int, int, int);

extern int
HDF4_def_var_fletcher32(int, int, int);

extern int
HDF4_def_var_chunking(int, int, int, const size_t *);

extern int
HDF4_def_var_fill(int, int, int, const void *);

extern int
HDF4_def_var_endian(int, int, int);

extern int
HDF4_def_var_filter(int, int, unsigned int, size_t, const unsigned int*);

extern int
HDF4_set_var_chunk_cache(int, int, size_t, size_t, float);

extern int
HDF4_get_var_chunk_cache(int, int, size_t *, size_t *, float *);

extern int
HDF4_inq_unlimdims(int, int *, int *);

extern int
HDF4_show_metadata(int);

extern int
HDF4_initialize(void);

#if defined(__cplusplus)
}
#endif

#endif /*_HDF4DISPATCH_H */
1 change: 1 addition & 0 deletions include/nc4internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ int nc4_type_free(NC_TYPE_INFO_T *type);
int nc4_nc4f_list_add(NC *nc, const char *path, int mode);
int nc4_var_add(NC_VAR_INFO_T **var);
int nc4_var_del(NC_VAR_INFO_T *var);
int nc4_vararray_add(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var);
int nc4_dim_list_add(NC_DIM_INFO_T **list, NC_DIM_INFO_T **dim);
int nc4_dim_list_del(NC_DIM_INFO_T **list, NC_DIM_INFO_T *dim);
int nc4_att_list_add(NC_ATT_INFO_T **list, NC_ATT_INFO_T **att);
Expand Down
Loading

0 comments on commit db41b2a

Please sign in to comment.