Merge branch 'master' into ejh_make_j_2

This commit is contained in:
Ed Hartnett 2017-11-10 02:52:55 -07:00 committed by GitHub
commit ec07a2b147
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 588 additions and 96 deletions

View File

@ -462,7 +462,7 @@ AC_MSG_CHECKING([whether netCDF extra tests should be run (developers only)])
AC_ARG_ENABLE([extra-tests],
[AS_HELP_STRING([--enable-extra-tests],
[enable some extra tests that may not pass because of known issues])])
test "x$enable_extra_tests" = xno || enable_extra_tests=yes
test "x$enable_extra_tests" = xyes || enable_extra_tests=no
AC_MSG_RESULT($enable_extra_tests)
if test "x$enable_extra_tests" = xyes; then
AC_DEFINE([EXTRA_TESTS], [1], [if true, run extra tests which may not work yet])

View File

@ -25,12 +25,12 @@ test_parse_SOURCES = test_parse.c test_common.h
test_meta_SOURCES = test_meta.c test_common.h
test_data_SOURCES = test_data.c test_common.h
TESTS += test_parse.sh
TESTS += test_meta.sh
TESTS += test_data.sh
if BUILD_UTILITIES
# These rely on ncdump
TESTS += test_raw.sh
TESTS += test_meta.sh
TESTS += test_data.sh
endif
if ENABLE_DAP_REMOTE_TESTS

View File

@ -73,7 +73,9 @@ full functionality. (See \ref architecture).
Requirements {#netcdf_requirements}
----------------------------------
* HDF5 1.8.9 or later (for netCDF-4 support)
* For netCDF-4 support
* HDF5 1.8.9 or later.
* HDF5 1.10.1 or later.
* zlib 1.2.5 or later (for netCDF-4 compression)
* curl 7.18.0 or later (for DAP remote access client support)

View File

@ -35,7 +35,6 @@ int
main()
{
printf("\n*** Checking HDF5 attribute functions some more.\n");
#ifdef EXTRA_TESTS
printf("*** Creating tst_xplatform2_3.nc with HDF only...");
{
hid_t fapl_id, fcpl_id;
@ -308,6 +307,5 @@ main()
free(vc_out[i].p);
}
SUMMARIZE_ERR;
#endif /* EXTRA_TESTS */
FINAL_RESULTS;
}

View File

@ -36,7 +36,6 @@ int
main()
{
printf("\n*** Checking HDF5 attribute functions for memory leaks.\n");
#ifdef EXTRA_TESTS
printf("*** Checking vlen of compound file...");
{
#define NUM_OBJ_2 2
@ -181,6 +180,5 @@ main()
free(vc_out);
}
SUMMARIZE_ERR;
#endif /* EXTRA_TESTS */
FINAL_RESULTS;
}

View File

@ -362,7 +362,6 @@ main()
}
SUMMARIZE_ERR;
#ifdef EXTRA_TESTS
printf("*** Checking that unlimited dimscale file can be read...");
{
@ -780,6 +779,5 @@ main()
}
SUMMARIZE_ERR;
#endif
FINAL_RESULTS;
}

View File

@ -6,13 +6,13 @@
but they use HDF5 the same way that netCDF-4 does, so if these
tests don't work, than netCDF-4 won't work either.
$Id: tst_h_dimscales1.c,v 1.2 2010/06/01 15:34:51 ed Exp $
@author Ed Hartnett
*/
#include "h5_err_macros.h"
#include <hdf5.h>
#include <H5DSpublic.h>
#define FILE_NAME "tst_h_dimscales.h5"
#define FILE_NAME "tst_h_dimscales1.h5"
int
main()
{
@ -36,35 +36,35 @@ main()
hsize_t dimscale_dims[1] = {DIM1_LEN};
/* Open file and create group. */
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT)) < 0) ERR;
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT)) < 0) ERR;
if ((grpid = H5Gcreate(fileid, GRP_NAME, 0)) < 0) ERR;
/* Create our dimension scale. Use the built-in NAME attribute
* on the dimscale. */
if ((dimscale_spaceid = H5Screate_simple(1, dimscale_dims,
dimscale_dims)) < 0) ERR;
if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT,
dimscale_spaceid, H5P_DEFAULT)) < 0) ERR;
if ((dimscale_spaceid = H5Screate_simple(1, dimscale_dims,
dimscale_dims)) < 0) ERR;
if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT,
dimscale_spaceid, H5P_DEFAULT)) < 0) ERR;
if (H5DSset_scale(dimscaleid, NAME_ATTRIBUTE) < 0) ERR;
/* Create a 1D variable which uses the dimscale. Attach a label
* to this scale. */
if ((var1_spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR;
if ((var1_datasetid = H5Dcreate(grpid, VAR1_NAME, H5T_NATIVE_INT,
var1_spaceid, H5P_DEFAULT)) < 0) ERR;
if ((var1_datasetid = H5Dcreate(grpid, VAR1_NAME, H5T_NATIVE_INT,
var1_spaceid, H5P_DEFAULT)) < 0) ERR;
if (H5DSattach_scale(var1_datasetid, dimscaleid, 0) < 0) ERR;
if (H5DSset_label(var1_datasetid, 0, FIFTIES_SONG) < 0) ERR;
/* Create a 1D variabls that doesn't use the dimension scale. */
if ((var2_datasetid = H5Dcreate(grpid, VAR2_NAME, H5T_NATIVE_INT,
var1_spaceid, H5P_DEFAULT)) < 0) ERR;
if ((var2_datasetid = H5Dcreate(grpid, VAR2_NAME, H5T_NATIVE_INT,
var1_spaceid, H5P_DEFAULT)) < 0) ERR;
/* Create a 2D dataset which uses the scale for one of its
* dimensions. */
if ((var3_spaceid = H5Screate_simple(2, dims, dims)) < 0) ERR;
if ((var3_datasetid = H5Dcreate(grpid, VAR3_NAME, H5T_NATIVE_INT,
var3_spaceid, H5P_DEFAULT)) < 0) ERR;
if ((var3_datasetid = H5Dcreate(grpid, VAR3_NAME, H5T_NATIVE_INT,
var3_spaceid, H5P_DEFAULT)) < 0) ERR;
if (H5DSattach_scale(var3_datasetid, dimscaleid, 0) < 0) ERR;
/* Detach the scale. */
@ -72,16 +72,15 @@ main()
/* Close up the shop. */
if (H5Dclose(dimscaleid) < 0 ||
H5Dclose(var1_datasetid) < 0 ||
H5Dclose(var2_datasetid) < 0 ||
H5Dclose(var3_datasetid) < 0 ||
H5Sclose(var1_spaceid) < 0 ||
H5Sclose(var3_spaceid) < 0 ||
H5Sclose(dimscale_spaceid) < 0 ||
H5Dclose(var1_datasetid) < 0 ||
H5Dclose(var2_datasetid) < 0 ||
H5Dclose(var3_datasetid) < 0 ||
H5Sclose(var1_spaceid) < 0 ||
H5Sclose(var3_spaceid) < 0 ||
H5Sclose(dimscale_spaceid) < 0 ||
H5Gclose(grpid) < 0 ||
H5Fclose(fileid) < 0) ERR;
H5Fclose(fileid) < 0) ERR;
}
SUMMARIZE_ERR;
FINAL_RESULTS;
}

View File

@ -1239,10 +1239,13 @@ nc_close(int ncid)
#endif
{
stat = ncp->dispatch->close(ncid);
stat = ncp->dispatch->close(ncid);
/* Remove from the nc list */
del_from_NCList(ncp);
free_NC(ncp);
if (!stat)
{
del_from_NCList(ncp);
free_NC(ncp);
}
}
return stat;
}

View File

@ -13,6 +13,23 @@ See \ref copyright file for copying and redistribution conditions.
#include <stdarg.h>
#include "netcdf.h"
#include "math.h"
/** \defgroup v2_api The Version 2 API
NetCDF's modern history began with the introduction of the V2 netCDF
API by Glenn Davis and Russ Rew in 1991. (The V1 API is lost to mists
of time.)
The V2 API is still fully supported, but should not be used for new
development.
All of the V2 functions have been reimplemented in terms of the V3 API
code; see the documentation for the related V3 functions to get more
documentation.
The V2 API is tested in test directory nctest.
*/
/* The subroutines in error.c emit no messages unless NC_VERBOSE bit
* is on. They call exit() when NC_FATAL bit is on. */
int ncopts = (NC_FATAL | NC_VERBOSE) ;
@ -220,12 +237,29 @@ dimsizes(int ncid, int varid, size_t *sizes)
return NC_NOERR;
}
/** \ingroup v2_api
/*
* Retrieves the number of record variables, the record variable ids, and the
* record size of each record variable. If any pointer to info to be returned
* is null, the associated information is not returned. Returns -1 on error.
*/
Retrieves the number of record variables, the record variable ids, and the
record size of each record variable. If any pointer to info to be returned
is null, the associated information is not returned. Returns -1 on error.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 functions nc_inq_nvars(),
nc_inq_unlimdim(), nc_inq_dim().
\param ncid file ID
\param nrecvarsp pointer that will get the number of record variables
in the file.
\param recvarids pointer to array that will get the variable IDs of
all variables that use the record dimension.
\param recsizes pointer to array that will dimension size of the
record dimension for each variable.
\returns ::NC_NOERR No error.
\returns ::NC_EBADID Bad ncid.
\returns ::NC_ENOTVAR Invalid variable ID.
\returns ::NC_EINVAL Invalid input
*/
int
nc_inq_rec(
int ncid,
@ -273,13 +307,25 @@ nc_inq_rec(
return NC_NOERR;
}
/** \ingroup v2_api
/*
* Write one record's worth of data, except don't write to variables for which
* the address of the data to be written is NULL. Return -1 on error. This is
* the same as the ncrecput() in the library, except that can handle errors
* better.
*/
Write one record's worth of data, except don't write to variables for which
the address of the data to be written is NULL. Return -1 on error. This is
the same as the ncrecput() in the library, except that can handle errors
better.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_put_vara().
\param ncid file ID
\param recnum the record number to write.
\param datap pointer to one record's worth of data for all variables.
\returns ::NC_NOERR No error.
\returns ::NC_EBADID Bad ncid.
\returns ::NC_ENOTVAR Invalid variable ID.
\returns ::NC_EINVAL Invalid input
*/
int
nc_put_rec(
int ncid,
@ -320,12 +366,27 @@ nc_put_rec(
}
/*
* Read one record's worth of data, except don't read from variables for which
* the address of the data to be read is null. Return -1 on error. This is
* the same as the ncrecget() in the library, except that can handle errors
* better.
*/
/** \ingroup v2_api
Read one record's worth of data, except don't read from variables for which
the address of the data to be read is null. Return -1 on error. This is
the same as the ncrecget() in the library, except that can handle errors
better.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_get_vara().
\param ncid file ID
\param recnum the record number to read.
\param datap pointer memory to hold one record's worth of data for all
variables.
\returns ::NC_NOERR No error.
\returns ::NC_EBADID Bad ncid.
\returns ::NC_ENOTVAR Invalid variable ID.
\returns ::NC_EINVAL Invalid input
*/
int
nc_get_rec(
int ncid,
@ -364,8 +425,18 @@ nc_get_rec(
return 0;
}
/*
*/
/** \ingroup v2_api
Show an error message and exit (based on ncopts).
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_strerror()
\param routine_name
\param err error code
\param fmt pointer to a char array containing string format
*/
void
nc_advise(const char *routine_name, int err, const char *fmt,...)
{
@ -399,6 +470,18 @@ nc_advise(const char *routine_name, int err, const char *fmt,...)
/* End error handling */
/** \ingroup v2_api
Create a netCDF file.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_create().
\param path path and filename of the file to be created.
\param cmode see nc_create() for full discussion of the create mode.
\returns the ncid of the created file.
*/
int
nccreate(const char* path, int cmode)
{
@ -412,7 +495,18 @@ nccreate(const char* path, int cmode)
return ncid;
}
/** \ingroup v2_api
Open a netCDF file.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_open().
\param path path and filename of the file to be created.
\param mode see nc_open() for full discussion of the open mode.
\returns the ncid of the created file.
*/
int
ncopen(const char *path, int mode)
{
@ -426,7 +520,17 @@ ncopen(const char *path, int mode)
return ncid;
}
/** \ingroup v2_api
Put file in define mode.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_redef().
\param ncid file ID
\returns 0 for success, -1 for failure.
*/
int
ncredef(int ncid)
{
@ -439,7 +543,17 @@ ncredef(int ncid)
return 0;
}
/** \ingroup v2_api
End define mode for file.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_enddef().
\param ncid file ID
\returns 0 for success, -1 for failure.
*/
int
ncendef(int ncid)
{
@ -452,7 +566,17 @@ ncendef(int ncid)
return 0;
}
/** \ingroup v2_api
Close a file.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_close().
\param ncid file ID
\returns 0 for success, -1 for failure.
*/
int
ncclose(int ncid)
{
@ -466,7 +590,22 @@ ncclose(int ncid)
return 0;
}
/** \ingroup v2_api
Learn about a file.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_inq().
\param ncid file ID
\param ndims pointer that will get number of dimensions.
\param nvars pointer that will get number of variables.
\param natts pointer that will get number of global attributes.
\param recdim pointer that will get dimension ID of record dimension,
or -1 if there is no record dimension.
\returns 0 for success, -1 for failure.
*/
int
ncinquire(
int ncid,
@ -498,7 +637,17 @@ ncinquire(
return ncid;
}
/** \ingroup v2_api
Sync a file.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_sync().
\param ncid file ID
\returns 0 for success, -1 for failure.
*/
int
ncsync(int ncid)
{
@ -512,7 +661,16 @@ ncsync(int ncid)
return 0;
}
/** \ingroup v2_api
Abort defining a file.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_abort().
\param ncid file ID
\returns 0 for success, -1 for failure.
*/
int
ncabort(int ncid)
{
@ -525,7 +683,20 @@ ncabort(int ncid)
return 0;
}
/** \ingroup v2_api
Define a dimension.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_def_dim().
\param ncid file ID
\param name name of dimension.
\param length length of the dimension, NC_UNLIMITED for a record
dimension.
\returns dimid or -1 for failure.
*/
int
ncdimdef(
int ncid,
@ -549,7 +720,18 @@ ncdimdef(
return dimid;
}
/** \ingroup v2_api
Find dimension ID from name.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_inq_dimid().
\param ncid file ID
\param name name of dimension.
\returns dimid or -1 for failure.
*/
int
ncdimid(int ncid, const char* name)
{
@ -563,7 +745,20 @@ ncdimid(int ncid, const char* name)
return dimid;
}
/** \ingroup v2_api
Learn about a dimension.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_inq_dim().
\param ncid file ID
\param dimid the dimension ID to learn about
\param name pointer that will get name of dimension.
\param length pointer that will get length of dimension.
\returns dimid or -1 for failure.
*/
int
ncdiminq(
int ncid,
@ -588,7 +783,19 @@ ncdiminq(
return dimid;
}
/** \ingroup v2_api
Rename a dimension.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_rename_dim().
\param ncid file ID
\param dimid the dimension ID.
\param name the new name.
\returns dimid or -1 for failure.
*/
int
ncdimrename(
int ncid,
@ -605,7 +812,21 @@ ncdimrename(
return dimid;
}
/** \ingroup v2_api
Define a variable.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_def_var().
\param ncid file ID
\param name the name of the variable.
\param datatype the data type of the variable.
\param ndims the number of dimensions.
\param dim array of dimension IDs.
\returns varid or -1 for failure.
*/
int
ncvardef(
int ncid,
@ -625,7 +846,18 @@ ncvardef(
return varid;
}
/** \ingroup v2_api
Learn a variable ID from the name.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_inq_varid().
\param ncid file ID
\param name the name of the variable.
\returns varid or -1 for failure.
*/
int
ncvarid(
int ncid,
@ -642,7 +874,23 @@ ncvarid(
return varid;
}
/** \ingroup v2_api
Learn about a variable.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_inq_var().
\param ncid file ID
\param varid the variable ID.
\param name pointer to array of char that will get name of variable.
\param datatype pointer that will get variable data type.
\param ndims pointer that will get number of dimensions.
\param dim pointer to array that will get dimension IDs.
\param natts pointer that will get number of variable attributes.
\returns varid or -1 for failure.
*/
int
ncvarinq(
int ncid,
@ -674,7 +922,20 @@ ncvarinq(
return varid;
}
/** \ingroup v2_api
Write 1 data value.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_put_var1().
\param ncid file ID
\param varid the variable ID.
\param index pointer to array of index values.
\param value pointer to data.
\returns 0 for success or -1 for failure.
*/
int
ncvarput1(
int ncid,
@ -698,7 +959,20 @@ ncvarput1(
return 0;
}
/** \ingroup v2_api
Read 1 data value.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_get_var1().
\param ncid file ID
\param varid the variable ID.
\param index pointer to array of index values.
\param value pointer that will get data.
\returns 0 for success or -1 for failure.
*/
int
ncvarget1(
int ncid,
@ -722,7 +996,21 @@ ncvarget1(
return 0;
}
/** \ingroup v2_api
Write some data.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_put_vara().
\param ncid file ID
\param varid the variable ID.
\param start pointer to array of start values.
\param count pointer to array of count values.
\param value pointer to data.
\returns 0 for success or -1 for failure.
*/
int
ncvarput(
int ncid,
@ -750,7 +1038,21 @@ ncvarput(
return 0;
}
/** \ingroup v2_api
Read some data.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_get_vara().
\param ncid file ID
\param varid the variable ID.
\param start pointer to array of start values.
\param count pointer to array of count values.
\param value pointer to data.
\returns 0 for success or -1 for failure.
*/
int
ncvarget(
int ncid,
@ -778,7 +1080,22 @@ ncvarget(
return 0;
}
/** \ingroup v2_api
Write strided data.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_put_vars().
\param ncid file ID
\param varid the variable ID.
\param start pointer to array of start values.
\param count pointer to array of count values.
\param stride pointer to array of stride values.
\param value pointer to data.
\returns 0 for success or -1 for failure.
*/
int
ncvarputs(
int ncid,
@ -816,7 +1133,22 @@ ncvarputs(
}
}
/** \ingroup v2_api
Read strided data.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_get_vars().
\param ncid file ID
\param varid the variable ID.
\param start pointer to array of start values.
\param count pointer to array of count values.
\param stride pointer to array of stride values.
\param value pointer to data.
\returns 0 for success or -1 for failure.
*/
int
ncvargets(
int ncid,
@ -853,7 +1185,23 @@ ncvargets(
}
}
/** \ingroup v2_api
Write mapped data.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_get_varm().
\param ncid file ID
\param varid the variable ID.
\param start pointer to array of start values.
\param count pointer to array of count values.
\param stride pointer to array of stride values.
\param map pointer to array of map values.
\param value pointer to data.
\returns 0 for success or -1 for failure.
*/
int
ncvarputg(
int ncid,
@ -910,7 +1258,23 @@ ncvarputg(
}
}
/** \ingroup v2_api
Read mapped data.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_get_varm().
\param ncid file ID
\param varid the variable ID.
\param start pointer to array of start values.
\param count pointer to array of count values.
\param stride pointer to array of stride values.
\param map pointer to array of map values.
\param value pointer to data.
\returns 0 for success or -1 for failure.
*/
int
ncvargetg(
int ncid,
@ -967,7 +1331,19 @@ ncvargetg(
}
}
/** \ingroup v2_api
Rename a variable.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_rename_var().
\param ncid file ID
\param varid the variable ID.
\param name the new name.
\returns varid or -1 for failure.
*/
int
ncvarrename(
int ncid,
@ -984,7 +1360,22 @@ ncvarrename(
return varid;
}
/** \ingroup v2_api
Write an attribute.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_put_att_int(), etc.
\param ncid file ID
\param varid the variable ID or NC_GLOBAL.
\param name the name of the attribute.
\param datatype the type of the attribute.
\param len the length of the attribute.
\param value the attribute value.
\returns dimid or -1 for failure.
*/
int
ncattput(
int ncid,
@ -1004,7 +1395,22 @@ ncattput(
return 0;
}
/** \ingroup v2_api
Learn about an attribute.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_inq_att().
\param ncid file ID
\param varid the variable ID.
\param name the name of the attribute.
\param datatype pointer that will get data type.
\param len pointer that will get length.
\returns 1 for success or -1 for failure. (That's a delightful
artifact of a by-gone era of C programming, isn't it?)
*/
int
ncattinq(
int ncid,
@ -1028,10 +1434,22 @@ ncattinq(
*len = (int) ll;
return 1;
}
/** \ingroup v2_api
Read an attribute.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_get_att_int(), etc.
\param ncid file ID.
\param varid the variable ID or NC_GLOBAL.
\param name the name of the attribute.
\param value pointer that will get the attribute data.
\returns 1 for success or -1 for failure.
*/
int
ncattget(
int ncid,
@ -1049,7 +1467,21 @@ ncattget(
return 1;
}
/** \ingroup v2_api
Copy an attribute.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_get_att_int(), etc.
\param ncid_in file ID to copy from.
\param varid_in the variable ID or NC_GLOBAL to copy from.
\param name the name of the attribute.
\param ncid_out file ID to copy to.
\param varid_out the variable ID or NC_GLOBAL to copy to.
\returns 0 for success or -1 for failure.
*/
int
ncattcopy(
int ncid_in,
@ -1068,7 +1500,20 @@ ncattcopy(
return 0;
}
/** \ingroup v2_api
Learn attribute name from its number.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_inq_attname().
\param ncid file ID
\param varid the variable ID.
\param attnum the number of the attribute.
\param name the name of the attribute.
\returns attnum for success or -1 for failure.
*/
int
ncattname(
int ncid,
@ -1086,7 +1531,20 @@ ncattname(
return attnum;
}
/** \ingroup v2_api
Rename an attribute.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_rename_att().
\param ncid file ID
\param varid the variable ID.
\param name the attribute name.
\param newname the new name.
\returns 1 for success or -1 for failure.
*/
int
ncattrename(
int ncid,
@ -1104,7 +1562,19 @@ ncattrename(
return 1;
}
/** \ingroup v2_api
Delete an attribute.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_delete_att().
\param ncid file ID
\param varid the variable ID.
\param name the attribute name.
\returns 1 for success or -1 for failure.
*/
int
ncattdel(
int ncid,
@ -1125,6 +1595,18 @@ ncattdel(
#ifndef NO_NETCDF_2
/** \ingroup v2_api
Set the fill mode.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_set_fill().
\param ncid file ID
\param fillmode NC_FILL or NC_NOFILL.
\returns oldmode for success or -1 for failure.
*/
int
ncsetfill(
int ncid,
@ -1141,7 +1623,20 @@ ncsetfill(
return oldmode;
}
/** \ingroup v2_api
Learn record variables and the lengths of the record dimension.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 functions nc_inq_var()/nc_inq_dim().
\param ncid file ID
\param nrecvars pointer that will get number of record variables.
\param recvarids pointer that will get array of record variable IDs.
\param recsizes pointer that will get array of record dimension length.
\returns oldmode for success or -1 for failure.
*/
int
ncrecinq(
int ncid,
@ -1183,7 +1678,22 @@ ncrecinq(
return (int) nrv;
}
/** \ingroup v2_api
Read one record's worth of data, except don't read from variables for which
the address of the data to be read is null. Return -1 on error. This is
the same as the nc_get_rec(), with poorer error handling.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_get_vara().
\param ncid file ID
\param recnum the record number to read.
\param datap pointer memory to hold one record's worth of data for all
variables.
\returns 0 for success, -1 for error.
*/
int
ncrecget(
int ncid,
@ -1200,7 +1710,21 @@ ncrecget(
return 0;
}
/** \ingroup v2_api
Write one record's worth of data, except don't write to variables for which
the address of the data to be written is NULL. Return -1 on error. This is
the same as the nc_put_rec(), but with poorer error handling.
This is part of the legacy V2 API of netCDF. New code should be
written with the V3 API. See V3 function nc_put_vara().
\param ncid file ID
\param recnum the record number to write.
\param datap pointer to one record's worth of data for all variables.
\returns 0 for success, -1 for error.
*/
int
ncrecput(
int ncid,

View File

@ -332,13 +332,8 @@ nc4_create_file(const char *path, int cmode, MPI_Comm comm, MPI_Info info,
* fail if there are any open objects in the file. */
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
BAIL(NC_EHDFERR);
#ifdef EXTRA_TESTS
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI))
BAIL(NC_EHDFERR);
#else
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG))
BAIL(NC_EHDFERR);
#endif /* EXTRA_TESTS */
#ifdef USE_PARALLEL4
/* If this is a parallel file create, set up the file creation
@ -2116,13 +2111,8 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc)
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
BAIL(NC_EHDFERR);
#ifdef EXTRA_TESTS
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI))
BAIL(NC_EHDFERR);
#else
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG))
BAIL(NC_EHDFERR);
#endif
#ifdef USE_PARALLEL4
/* If this is a parallel file create, set up the file creation
@ -2998,7 +2988,7 @@ close_netcdf4_file(NC_HDF5_FILE_INFO_T *h5, int abort)
exit:
/* Free the nc4_info struct; above code should have reclaimed
everything else */
if(h5 != NULL)
if(!retval && h5 != NULL)
free(h5);
return retval;
}

View File

@ -117,11 +117,6 @@ EXTRA_DIST += ref_tst_diskless2.cdl tst_diskless5.cdl CMakeLists.txt
# regenerate.
#MAINTAINERCLEANFILES = test_get.c test_put.c
all:
cp $(top_srcdir)/libsrc/ncx.c .
CLEANFILES += ncx.c
# This rule tells make how to turn our .m4 files into .c files.
.m4.c:
m4 $(AM_M4FLAGS) $(M4FLAGS) $< >$@

View File

@ -662,7 +662,6 @@
# define RANK_wat_a2 4
# define RANK_wat_a3 4
#ifdef EXTRA_TESTS
#define MEGABYTE 1048576
void
get_mem_used2(int *mem_used)
@ -691,7 +690,6 @@ get_mem_used2(int *mem_used)
*mem_used = -1;
fclose(pf);
}
#endif
int
main()
@ -2005,17 +2003,13 @@ main()
int wat_a1_dims[RANK_wat_a1];
int wat_a2_dims[RANK_wat_a2];
int wat_a3_dims[RANK_wat_a3];
#ifdef EXTRA_TESTS
int memused;
#endif /* EXTRA_TESTS */
printf("\n*** Testing CAM output file in netCDF-4.\n");
printf("*** creating file...");
#ifdef EXTRA_TESTS
get_mem_used2(&memused);
printf("data memory %d MB\n", memused);
#endif /* EXTRA_TESTS */
if (nc_set_chunk_cache(0, 1009, .75)) ERR;
@ -7389,26 +7383,20 @@ main()
if (nc_put_att_text(ncid, wat_a3_id, "cell_methods", 10, "time: mean")) ERR;
#ifdef EXTRA_TESTS
get_mem_used2(&memused);
printf("before enddef data memory %d MB\n", memused);
#endif
/* leave define mode */
if (nc_enddef (ncid)) ERR;
#ifdef EXTRA_TESTS
get_mem_used2(&memused);
printf("before close data memory %d MB\n", memused);
#endif
/* assign variable data */
if (nc_close(ncid)) ERR;
#ifdef EXTRA_TESTS
get_mem_used2(&memused);
printf("after close data memory %d MB\n", memused);
#endif
SUMMARIZE_ERR;
FINAL_RESULTS;

View File

@ -304,8 +304,13 @@ main(int argc, char **argv)
/* Close the file. */
if (nc_close(ncid) != NC_EINVAL) ERR;
unsigned char ubyte_value = 42;
if (nc_redef(ncid)) ERR;
if (nc_insert_enum(ncid, typeid, "name", &ubyte_value)) ERR;
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
FINAL_RESULTS;
}

View File

@ -105,7 +105,6 @@ main() {/* create data.nc */
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
#ifdef EXTRA_TESTS
printf("*** testing opening of many files...");
{
int i, ncid;
@ -121,6 +120,5 @@ main() {/* create data.nc */
/*printf("last ncid: %d\n", ncid);*/
}
SUMMARIZE_ERR;
#endif
FINAL_RESULTS;
}

View File

@ -390,11 +390,7 @@ main(int argc, char **argv)
/* Open the file with HDF5 while netcdf still has it open. */
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
/* Turn this off for*/
#ifdef EXTRA_TESTS
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI)) ERR;
#else
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG)) ERR;
#endif
if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, fapl_id)) < 0) ERR;
if (H5Pclose(fapl_id) < 0) ERR;
if (H5Fclose(fileid) < 0) ERR;

View File

@ -558,7 +558,6 @@ main(int argc, char **argv)
#define NUM_OBJ 3
printf("\n*** Checking HDF5 attribute functions some more.\n");
#ifdef EXTRA_TESTS
printf("*** Opening tst_xplatform2_3.nc...");
{
hid_t fileid, grpid, attid;
@ -651,6 +650,5 @@ main(int argc, char **argv)
H5Fclose(fileid) < 0) ERR;
}
SUMMARIZE_ERR;
#endif /* EXTRA_TESTS */
FINAL_RESULTS;
}

View File

@ -27,7 +27,9 @@ test_vara_SOURCES = test_vara.c t_srcdir.h
if ENABLE_DAP
check_PROGRAMS += t_dap3a test_cvt3 test_vara
TESTS += t_dap3a test_cvt3 test_vara
if BUILD_UTILITIES
TESTS += tst_ncdap3.sh
endif
# remote tests are optional
# because the server may be down or inaccessible
@ -37,10 +39,10 @@ check_PROGRAMS += findtestserver
findtestserver_SOURCES = findtestserver.c
if BUILD_UTILITIES
TESTS += tst_ber.sh tst_remote3.sh tst_formatx.sh
TESTS += tst_ber.sh tst_remote3.sh tst_formatx.sh testurl.sh
endif
TESTS += test_partvar testurl.sh
TESTS += test_partvar
if ENABLE_DAP_LONG_TESTS
TESTS += tst_longremote3.sh

View File

@ -33,11 +33,9 @@ compare_test_files.log: nctest.log
# This will the test program with valgrind, the memory checking
# tool. (Valgrind must be present for this to work.)
if EXTRA_TESTS
if USE_VALGRIND_TESTS
TESTS += run_valgrind_tests.sh
endif # USE_VALGRIND_TESTS
endif # EXTRA_TESTS
# These are the source files for the nctest program.
nctest_SOURCES = add.c add.h atttests.c cdftests.c dimtests.c driver.c \