From a8673c3dfeb6672a03d27c09d4ecc388e5e4124a Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 27 Nov 2018 16:09:17 -0700 Subject: [PATCH] Moving provenance info out so that it doesn't depend on netCDF4 support to display. --- include/Makefile.am | 3 ++- include/nc4internal.h | 31 ++------------------------- include/nc_provenance.h | 47 +++++++++++++++++++++++++++++++++++++++++ ncdump/nccopy.c | 38 ++++++++++++++++----------------- ncdump/ncdump.c | 15 ++++++------- 5 files changed, 77 insertions(+), 57 deletions(-) create mode 100644 include/nc_provenance.h diff --git a/include/Makefile.am b/include/Makefile.am index 5aaa9c4df..fb860665c 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -19,7 +19,8 @@ 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 hdf5internal.h +ncwinpath.h ncfilter.h ncindex.h hdf4dispatch.h hdf5internal.h \ +nc_provenance.h if USE_DAP noinst_HEADERS += ncdap.h diff --git a/include/nc4internal.h b/include/nc4internal.h index fdde906c8..b9c12100c 100644 --- a/include/nc4internal.h +++ b/include/nc4internal.h @@ -21,6 +21,7 @@ #include "ncdimscale.h" #include "nc_logging.h" #include "ncindex.h" +#include "nc_provenance.h" #ifdef USE_PARALLEL #include "netcdf_par.h" @@ -451,34 +452,6 @@ extern const NC_reservedatt* NC_findreserved(const char* name); #define NC_ATT_COORDINATES COORDINATES /*defined above*/ #define NC_ATT_FORMAT "_Format" -/**************************************************/ -/** -For netcdf4 files, capture state information about the following: -1. Global: netcdf library version -2. Global: hdf5 library version -3. Per file: superblock version -4. Per File: was it created by netcdf-4? -5. Per file: _NCProperties attribute -*/ - -/* Most of this needs to be moved to hdf5internal.h */ - -#define NCPROPS "_NCProperties" -#define NCPVERSION "version" /* Of the properties format */ -#define NCPHDF5LIB1 "hdf5libversion" -#define NCPNCLIB1 "netcdflibversion" -#define NCPHDF5LIB2 "hdf5" -#define NCPNCLIB2 "netcdf" -#define NCPROPS_VERSION (2) -/* Version 2 changes this because '|' was causing bash problems */ -#define NCPROPSSEP1 '|' -#define NCPROPSSEP2 ',' - - -/* Other hidden attributes */ -#define ISNETCDF4ATT "_IsNetcdf4" -#define SUPERBLOCKATT "_SuperblockVersion" - struct NCPROVENANCE { int superblockversion; struct NCPROPINFO { @@ -488,7 +461,7 @@ struct NCPROVENANCE { "netcdflibversion=" Version 2 format is: "==...|=..." - */ + */ /* The _NCProperties values are stored as an arbitrary set of (key,value) pairs */ /* It is assumed that the first entry is the primary library diff --git a/include/nc_provenance.h b/include/nc_provenance.h new file mode 100644 index 000000000..ef9825a3d --- /dev/null +++ b/include/nc_provenance.h @@ -0,0 +1,47 @@ +/* Copyright 2005-2018 University Corporation for Atmospheric + Research/Unidata. */ +/** +/** + * @file + * @internal Contains information for creating provenance + * 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 +to make printing these hidden attributes available to +netcdf3 as well. + +For netcdf4 files, capture state information about the following: +1. Global: netcdf library version +2. Global: hdf5 library version +3. Per file: superblock version +4. Per File: was it created by netcdf-4? +5. Per file: _NCProperties attribute +*/ + +#ifndef _NCPROVENANCE_ +#define _NCPROVENANCE_ + +#define NCPROPS "_NCProperties" +#define NCPVERSION "version" /* Of the properties format */ +#define NCPHDF5LIB1 "hdf5libversion" +#define NCPNCLIB1 "netcdflibversion" +#define NCPHDF5LIB2 "hdf5" +#define NCPNCLIB2 "netcdf" +#define NCPROPS_VERSION (2) +/* Version 2 changes this because '|' was causing bash problems */ +#define NCPROPSSEP1 '|' +#define NCPROPSSEP2 ',' + + +/* Other hidden attributes */ +#define ISNETCDF4ATT "_IsNetcdf4" +#define SUPERBLOCKATT "_SuperblockVersion" + + +#endif /* _NCPROVENANCE_ */ diff --git a/ncdump/nccopy.c b/ncdump/nccopy.c index 5f0f2cb8e..81842b2d6 100644 --- a/ncdump/nccopy.c +++ b/ncdump/nccopy.c @@ -696,29 +696,29 @@ copy_var_filter(int igrp, int varid, int ogrp, int o_varid, int inkind, int outk outputdefined = 0; /* default is no filter defined */ /* Only bother to look if output is netcdf-4 variant */ if(outnc4) { - /* See if any output filter spec is defined for this output variable */ - for(i=0;i 0) { int i; - for(i=0;i