Merge branch 'ejh_hdf5internal' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into pr-aggregation.wif

This commit is contained in:
Ward Fisher 2018-07-18 14:12:26 -06:00
commit b1078c13f0
15 changed files with 85 additions and 73 deletions

View File

@ -17,9 +17,9 @@ include_HEADERS += netcdf_mem.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 ncrc.h \
ncauth.h ncoffsets.h nctestserver.h nc4dispatch.h nc3dispatch.h \
ncexternl.h ncwinpath.h ncfilter.h ncindex.h hdf4dispatch.h
nc4internal.h nctime.h nc3internal.h onstack.h ncrc.h ncauth.h \
ncoffsets.h nctestserver.h nc4dispatch.h nc3dispatch.h ncexternl.h \
ncwinpath.h ncfilter.h ncindex.h hdf4dispatch.h hdf5internal.h
if USE_DAP
noinst_HEADERS += ncdap.h

57
include/hdf5internal.h Normal file
View File

@ -0,0 +1,57 @@
/* Copyright 2005-2018 University Corporation for Atmospheric
Research/Unidata. */
/**
* @file This header file contains macros, types, and prototypes for
* the HDF5 code in libhdf5. This header should not be included in
* code outside libhdf5.
*
* @author Ed Hartnett
*/
#ifndef _HDF5INTERNAL_
#define _HDF5INTERNAL_
#include "config.h"
#include <hdf5.h>
#include <hdf5_hl.h>
#include "nc4internal.h"
#include "ncdimscale.h"
#include "nc4dispatch.h"
#define NC_MAX_HDF5_NAME (NC_MAX_NAME + 10)
/* These have to do with creating chuncked datasets in HDF5. */
#define NC_HDF5_UNLIMITED_DIMSIZE (0)
#define NC_HDF5_CHUNKSIZE_FACTOR (10)
#define NC_HDF5_MIN_CHUNK_SIZE (2)
#define NC_EMPTY_SCALE "NC_EMPTY_SCALE"
/* This is an attribute I had to add to handle multidimensional
* coordinate variables. */
#define COORDINATES "_Netcdf4Coordinates"
#define COORDINATES_LEN (NC_MAX_NAME * 5)
/* This is used when the user defines a non-coordinate variable with
* same name as a dimension. */
#define NON_COORD_PREPEND "_nc4_non_coord_"
/* An attribute in the HDF5 root group of this name means that the
* file must follow strict netCDF classic format rules. */
#define NC3_STRICT_ATT_NAME "_nc3_strict"
/* If this attribute is present on a dimscale variable, use the value
* as the netCDF dimid. */
#define NC_DIMID_ATT_NAME "_Netcdf4Dimid"
/** This is the name of the class HDF5 dimension scale attribute. */
#define HDF5_DIMSCALE_CLASS_ATT_NAME "CLASS"
/** This is the name of the name HDF5 dimension scale attribute. */
#define HDF5_DIMSCALE_NAME_ATT_NAME "NAME"
/* These functions do HDF5 things. */
int rec_detach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid);
int rec_reattach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid);
#endif /* _HDF5INTERNAL_ */

View File

@ -1,8 +1,10 @@
/* Copyright 2005-2018 University Corporation for Atmospheric
Research/Unidata. */
/**
* @file This header file contains the definitions of structs used to
* hold netCDF file metadata in memory.
* @file This header file contains macros, types and prototypes used
* to build and manipulate the netCDF metadata model.
*
* @author Ed Hartnett, Dennis Heimbigner, Ward Fisher
*/
#ifndef _NC4INTERNAL_
@ -14,7 +16,6 @@
#include <ctype.h>
#include <stdarg.h>
#include <string.h>
#include <hdf5.h>
#include "ncdimscale.h"
#include "nc_logging.h"
@ -37,7 +38,6 @@
typedef enum {GET, PUT} NC_PG_T;
typedef enum {NCNAT, NCVAR, NCDIM, NCATT, NCTYP, NCFLD, NCGRP} NC_SORT;
#define NC_MAX_HDF5_NAME (NC_MAX_NAME + 10)
#define NC_V2_ERR (-1)
/* The name of the root group. */
@ -74,36 +74,6 @@ typedef enum {NCNAT, NCVAR, NCDIM, NCATT, NCTYP, NCFLD, NCGRP} NC_SORT;
#define X_DOUBLE_MAX 1.7976931348623157e+308
#define X_DOUBLE_MIN (-X_DOUBLE_MAX)
/* These have to do with creating chuncked datasets in HDF5. */
#define NC_HDF5_UNLIMITED_DIMSIZE (0)
#define NC_HDF5_CHUNKSIZE_FACTOR (10)
#define NC_HDF5_MIN_CHUNK_SIZE (2)
#define NC_EMPTY_SCALE "NC_EMPTY_SCALE"
/* This is an attribute I had to add to handle multidimensional
* coordinate variables. */
#define COORDINATES "_Netcdf4Coordinates"
#define COORDINATES_LEN (NC_MAX_NAME * 5)
/* This is used when the user defines a non-coordinate variable with
* same name as a dimension. */
#define NON_COORD_PREPEND "_nc4_non_coord_"
/* An attribute in the HDF5 root group of this name means that the
* file must follow strict netCDF classic format rules. */
#define NC3_STRICT_ATT_NAME "_nc3_strict"
/* If this attribute is present on a dimscale variable, use the value
* as the netCDF dimid. */
#define NC_DIMID_ATT_NAME "_Netcdf4Dimid"
/** This is the name of the class HDF5 dimension scale attribute. */
#define HDF5_DIMSCALE_CLASS_ATT_NAME "CLASS"
/** This is the name of the name HDF5 dimension scale attribute. */
#define HDF5_DIMSCALE_NAME_ATT_NAME "NAME"
/** This is the number of netCDF atomic types. */
#define NUM_ATOMIC_TYPES (NC_MAX_ATOMIC_TYPE + 1)
@ -352,8 +322,6 @@ int nc4_convert_type(const void *src, void *dest, const nc_type src_type,
const void *fill_value, int strict_nc3);
/* These functions do HDF5 things. */
int rec_detach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid);
int rec_reattach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid);
int delete_existing_dimscale_dataset(NC_GRP_INFO_T *grp, int dimid, NC_DIM_INFO_T *dim);
int nc4_open_var_grp2(NC_GRP_INFO_T *grp, int varid, hid_t *dataset);
int nc4_put_vars(NC *nc, int ncid, int varid, const size_t *startp,
@ -521,4 +489,4 @@ extern int NC4_hdf5get_libversion(unsigned*,unsigned*,unsigned*);/*libsrc4/nc4hd
extern int NC4_hdf5get_superblock(struct NC_FILE_INFO*, int*);/*libsrc4/nc4hdf.c*/
extern int NC4_isnetcdf4(struct NC_FILE_INFO*); /*libsrc4/nc4hdf.c*/
#endif /* _NETCDF4_ */
#endif /* _NC4INTERNAL_ */

View File

@ -8,6 +8,8 @@
#ifndef _NCDIMSCALE_H_
#define _NCDIMSCALE_H_
#include <hdf5.h>
typedef struct hdf5_objid
{
unsigned long fileno[2]; /* file number */

View File

@ -11,10 +11,8 @@
* @author Ed Hartnett
*/
#include "nc.h"
#include "nc4internal.h"
#include "nc4dispatch.h"
#include "ncdispatch.h"
#include "config.h"
#include "hdf5internal.h"
int nc4typelen(nc_type type);

View File

@ -11,8 +11,8 @@
* @author Ed Hartnett
*/
#include "nc4internal.h"
#include "nc4dispatch.h"
#include "config.h"
#include "hdf5internal.h"
/**
* @internal Dimensions are defined in attributes attached to the

View File

@ -12,15 +12,7 @@
*/
#include "config.h"
#include <errno.h> /* netcdf functions sometimes return system errors */
#include "nc.h"
#include "nc4internal.h"
#include "nc4dispatch.h"
#include "netcdf_mem.h"
#ifdef USE_HDF4
#include <mfhdf.h>
#endif
#include <hdf5_hl.h>
#include "hdf5internal.h"
extern int nc4_vararray_add(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var);

View File

@ -11,8 +11,8 @@
* @author Ed Hartnett
*/
#include "nc4internal.h"
#include "nc4dispatch.h"
#include "config.h"
#include "hdf5internal.h"
/**
* @internal Create a group. Its ncid is returned in the new_ncid

View File

@ -13,12 +13,9 @@
*
* @author Ed Hartnett
*/
#include "config.h"
#include "nc4internal.h"
#include "nc.h" /* from libsrc */
#include "ncdispatch.h" /* from libdispatch */
#include "ncutf8.h"
#include "H5DSpublic.h"
#include "hdf5internal.h"
#undef DEBUGH5

View File

@ -11,8 +11,9 @@
*
* @author Ed Hartnett
*/
#include "nc4internal.h"
#include "nc4dispatch.h"
#include "config.h"
#include "hdf5internal.h"
/**
* @internal Determine if two types are equal.

View File

@ -14,9 +14,7 @@
*/
#include "config.h"
#include "nc4internal.h"
#include "nc4dispatch.h"
#include <H5DSpublic.h>
#include "hdf5internal.h"
#include <math.h>
#ifdef HAVE_INTTYPES_H

View File

@ -6,12 +6,9 @@
* and redistribution conditions.
* @author Dennis Heimbigner
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <hdf5.h>
#include "netcdf.h"
#include "nc4internal.h"
#include "hdf5internal.h"
#define HDF5_MAX_NAME 1024 /**< HDF5 max name. */

View File

@ -18,6 +18,7 @@
#include "nc.h"
#include "nc4internal.h"
#include "hdf5internal.h"
#include "nc4dispatch.h"
#include "ncdispatch.h"

View File

@ -12,6 +12,7 @@
#include <nc4internal.h>
#include "nc4dispatch.h"
#include "hdf5internal.h"
#include <math.h>
/* Szip options. */

View File

@ -10,7 +10,7 @@
#include <config.h>
#include <nc_tests.h>
#include "err_macros.h"
#include "nc4internal.h"
#include "hdf5internal.h"
/* The data file we will create. */
#define FILE_NAME "tst_atts.nc"