2018-07-12 21:05:21 +08:00
|
|
|
/* 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"
|
2018-07-17 22:29:47 +08:00
|
|
|
#include <hdf5.h>
|
|
|
|
#include <hdf5_hl.h>
|
2018-07-16 18:50:15 +08:00
|
|
|
#include "nc4internal.h"
|
2018-07-12 21:05:21 +08:00
|
|
|
#include "ncdimscale.h"
|
2018-07-16 18:50:15 +08:00
|
|
|
#include "nc4dispatch.h"
|
2018-07-12 21:05:21 +08:00
|
|
|
|
|
|
|
#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"
|
|
|
|
|
2018-07-19 22:50:53 +08:00
|
|
|
/** Strut to hold HDF5-specific info for the file. */
|
|
|
|
typedef struct NC_HDF5_FILE_INFO
|
|
|
|
{
|
|
|
|
hid_t hdfid;
|
|
|
|
} NC_HDF5_FILE_INFO_T;
|
|
|
|
|
2018-11-08 22:09:11 +08:00
|
|
|
/* This is a struct to handle the dim metadata. */
|
|
|
|
typedef struct NC_HDF5_DIM_INFO
|
|
|
|
{
|
|
|
|
hid_t hdf_dimscaleid; /* Non-zero if a DIM_WITHOUT_VARIABLE dataset is in use (no coord var). */
|
|
|
|
HDF5_OBJID_T hdf5_objid;
|
|
|
|
} NC_HDF5_DIM_INFO_T;
|
|
|
|
|
2018-11-08 02:33:02 +08:00
|
|
|
/** Strut to hold HDF5-specific info for attributes. */
|
|
|
|
typedef struct NC_HDF5_ATT_INFO
|
|
|
|
{
|
|
|
|
hid_t native_hdf_typeid; /* Native HDF5 datatype for attribute's data */
|
|
|
|
} NC_HDF5_ATT_INFO_T;
|
|
|
|
|
2018-11-12 22:40:15 +08:00
|
|
|
/* Struct to hold HDF5-specific info for a group. */
|
|
|
|
typedef struct NC_HDF5_GRP_INFO
|
|
|
|
{
|
|
|
|
hid_t hdf_grpid;
|
|
|
|
} NC_HDF5_GRP_INFO_T;
|
|
|
|
|
2018-07-12 21:05:21 +08:00
|
|
|
/* 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);
|
2018-08-21 22:32:39 +08:00
|
|
|
void reportopenobjects(int log, hid_t);
|
2018-10-23 19:39:00 +08:00
|
|
|
int nc4_rec_grp_HDF5_del(NC_GRP_INFO_T *grp);
|
2018-09-07 05:13:09 +08:00
|
|
|
|
2018-08-26 11:44:41 +08:00
|
|
|
/* Used by NC4_set_provenance */
|
|
|
|
int nc4_put_att(NC_GRP_INFO_T* grp, int varid, const char *name, nc_type file_type,
|
|
|
|
size_t len, const void *data, nc_type mem_type, int force);
|
2018-09-07 05:13:09 +08:00
|
|
|
|
2018-09-05 01:27:47 +08:00
|
|
|
/* In-memory functions */
|
|
|
|
extern hid_t NC4_image_init(NC_FILE_INFO_T* h5);
|
|
|
|
extern void NC4_image_finalize(void*);
|
2018-09-07 05:13:09 +08:00
|
|
|
|
2018-08-07 00:49:31 +08:00
|
|
|
/* These functions are internal to the libhdf5 directory. */
|
|
|
|
int nc4_detect_preserve_dimids(NC_GRP_INFO_T *grp, nc_bool_t *bad_coord_orderp);
|
|
|
|
int hdf5_set_log_level();
|
2018-08-09 20:41:54 +08:00
|
|
|
int nc4_get_fill_value(NC_FILE_INFO_T *h5, NC_VAR_INFO_T *var, void **fillp);
|
2018-08-07 00:49:31 +08:00
|
|
|
|
2018-07-12 21:05:21 +08:00
|
|
|
#endif /* _HDF5INTERNAL_ */
|