Skip to content

Commit

Permalink
Merge pull request #1264 from Unidata/pr-aggregation.wif
Browse files Browse the repository at this point in the history
YAA (Yet Another Aggregation)
  • Loading branch information
WardF authored Jan 2, 2019
2 parents b16ecea + 9e94e32 commit a26d188
Show file tree
Hide file tree
Showing 22 changed files with 11,268 additions and 1,281 deletions.
9 changes: 4 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,12 @@ if test "x$enable_large_file_tests" = xyes; then
fi

# Does the user want to run benchmarks?
AC_MSG_CHECKING([whether benchmarks should be run (experimental)])
AC_MSG_CHECKING([whether benchmarks should be run])
AC_ARG_ENABLE([benchmarks],
[AS_HELP_STRING([--enable-benchmarks],
[Run benchmarks. This is an experimental feature. You must fetch
sample data files from the Unidata ftp site to use these benchmarks.
The benchmarks are a bunch of extra tests, which are timed. We use these
tests to check netCDF performance.])])
[Run benchmarks. This will cause sample data files from the Unidata ftp
site to be fetched. The benchmarks are a bunch of extra tests, which
are timed. We use these tests to check netCDF performance.])])
test "x$enable_benchmarks" = xyes || enable_benchmarks=no
AC_MSG_RESULT($enable_benchmarks)
AM_CONDITIONAL(BUILD_BENCHMARKS, [test x$enable_benchmarks = xyes])
Expand Down
1 change: 1 addition & 0 deletions debug/README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
This directory contains various scripts for debugging by Dennis
Heimbigner @ Unidata.
DO NOT DELETE.
USE AT YOUR OWN PERIL.


2 changes: 1 addition & 1 deletion debug/cf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ NCLIB="${NCLIB}/build/liblib"
#G="-GUnix Makefiles"
#T="--trace-expand"
cmake "${G}" $FLAGS ..
if test "x$NOBUILD" == x ; then
if test "x$NOBUILD" = x ; then
make all
make test
fi
Expand Down
2 changes: 0 additions & 2 deletions include/hdf5internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ int hdf5_set_log_level();
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_rec_match_dimscales(NC_GRP_INFO_T *grp);

/* Write metadata. */
int nc4_rec_write_metadata(NC_GRP_INFO_T *grp, nc_bool_t bad_coord_order);
Expand Down Expand Up @@ -137,7 +136,6 @@ extern hid_t NC4_image_init(NC_FILE_INFO_T* h5);
extern void NC4_image_finalize(void*);

/* 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 nc4_get_fill_value(NC_FILE_INFO_T *h5, NC_VAR_INFO_T *var, void **fillp);


Expand Down
8 changes: 4 additions & 4 deletions include/nc4internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ typedef struct NC_VAR_INFO
{
NC_OBJ hdr;
char *hdf5_name; /* used if different from name */
struct NC_GRP_INFO* container; /* containing group */
struct NC_GRP_INFO *container; /* containing group */
size_t ndims;
int *dimids;
NC_DIM_INFO_T** dim;
NC_DIM_INFO_T **dim;
nc_bool_t is_new_var; /* True if variable is newly created */
nc_bool_t was_coord_var; /* True if variable was a coordinate var, but either the dim or var has been renamed */
nc_bool_t became_coord_var; /* True if variable _became_ a coordinate var, because either the dim or var has been renamed */
Expand All @@ -154,7 +154,7 @@ typedef struct NC_VAR_INFO
nc_bool_t written_to; /* True if variable has data written to it */
struct NC_TYPE_INFO *type_info;
int atts_not_read; /* If true, the atts have not yet been read. */
NCindex* att; /* NCindex<NC_ATT_INFO_T*> */
NCindex *att; /* NCindex<NC_ATT_INFO_T*> */
nc_bool_t no_fill; /* True if no fill value is defined for var */
void *fill_value;
size_t *chunksizes;
Expand All @@ -172,7 +172,7 @@ typedef struct NC_VAR_INFO
/* Stuff for arbitrary filters */
unsigned int filterid;
size_t nparams;
unsigned int* params;
unsigned int *params;
} NC_VAR_INFO_T;

typedef struct NC_FIELD_INFO
Expand Down
2 changes: 0 additions & 2 deletions include/nc_provenance.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* info and/or displaying provenance info.
*
* @author Dennis Heimbigner, Ward Fisher
*/
/**
It has come to pass that we can't guarantee that this information is
contained only within netcdf4 files. As a result, we need
Expand Down
80 changes: 79 additions & 1 deletion libhdf5/hdf5file.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,84 @@ NC_findreserved(const char* name)
return NULL;
}

/**
* @internal Recursively determine if there is a mismatch between
* order of coordinate creation and associated dimensions in this
* group or any subgroups, to find out if we have to handle that
* situation. Also check if there are any multidimensional coordinate
* variables defined, which require the same treatment to fix a
* potential bug when such variables occur in subgroups.
*
* @param grp Pointer to group info struct.
* @param bad_coord_orderp Pointer that gets 1 if there is a bad
* coordinate order.
*
* @returns NC_NOERR No error.
* @returns NC_EHDFERR HDF5 returned an error.
* @author Ed Hartnett
*/
static int
detect_preserve_dimids(NC_GRP_INFO_T *grp, nc_bool_t *bad_coord_orderp)
{
NC_VAR_INFO_T *var;
NC_GRP_INFO_T *child_grp;
int last_dimid = -1;
int retval;
int i;

/* Iterate over variables in this group */
for (i=0; i < ncindexsize(grp->vars); i++)
{
var = (NC_VAR_INFO_T*)ncindexith(grp->vars,i);
if (var == NULL) continue;
/* Only matters for dimension scale variables, with non-scalar dimensionality */
if (var->dimscale && var->ndims)
{
/* If the user writes coord vars in a different order then he
* defined their dimensions, then, when the file is reopened, the
* order of the dimids will change to match the order of the coord
* vars. Detect if this is about to happen. */
if (var->dimids[0] < last_dimid)
{
LOG((5, "%s: %s is out of order coord var", __func__, var->hdr.name));
*bad_coord_orderp = NC_TRUE;
return NC_NOERR;
}
last_dimid = var->dimids[0];

/* If there are multidimensional coordinate variables defined, then
* it's also necessary to preserve dimension IDs when the file is
* reopened ... */
if (var->ndims > 1)
{
LOG((5, "%s: %s is multidimensional coord var", __func__, var->hdr.name));
*bad_coord_orderp = NC_TRUE;
return NC_NOERR;
}

/* Did the user define a dimension, end define mode, reenter define
* mode, and then define a coordinate variable for that dimension?
* If so, dimensions will be out of order. */
if (var->is_new_var || var->became_coord_var)
{
LOG((5, "%s: coord var defined after enddef/redef", __func__));
*bad_coord_orderp = NC_TRUE;
return NC_NOERR;
}
}
}

/* If there are any child groups, check them also for this condition. */
for (i = 0; i < ncindexsize(grp->children); i++)
{
if (!(child_grp = (NC_GRP_INFO_T *)ncindexith(grp->children, i)))
continue;
if ((retval = detect_preserve_dimids(child_grp, bad_coord_orderp)))
return retval;
}
return NC_NOERR;
}

/**
* @internal This function will write all changed metadata and flush
* HDF5 file to disk.
Expand Down Expand Up @@ -127,7 +205,7 @@ sync_netcdf4_file(NC_FILE_INFO_T *h5)
/* Check to see if the coordinate order is messed up. If
* detected, propagate to all groups to consistently store
* dimids. */
if ((retval = nc4_detect_preserve_dimids(h5->root_grp, &bad_coord_order)))
if ((retval = detect_preserve_dimids(h5->root_grp, &bad_coord_order)))
return retval;

/* Write all the metadata. */
Expand Down
Loading

0 comments on commit a26d188

Please sign in to comment.