more docs, more cleaning

This commit is contained in:
Ed Hartnett 2017-12-04 12:21:14 -07:00
parent fec74e18ef
commit 4de61e21f2
25 changed files with 3532 additions and 3700 deletions

View File

@ -788,6 +788,7 @@ INPUT = \
@abs_top_srcdir@/libdispatch/dparallel.c \
@abs_top_srcdir@/libdispatch/derror.c \
@abs_top_srcdir@/libdispatch/dv2i.c \
@abs_top_srcdir@/libdispatch/dcopy.c \
@abs_top_srcdir@/libsrc4/nc4file.c \
@abs_top_srcdir@/libsrc4/nc4var.c \
@abs_top_srcdir@/libsrc4/nc4hdf.c \
@ -796,6 +797,9 @@ INPUT = \
@abs_top_srcdir@/libsrc4/nc4grp.c \
@abs_top_srcdir@/libsrc4/ncfunc.c \
@abs_top_srcdir@/libsrc4/nc4dim.c \
@abs_top_srcdir@/libsrc4/nc4attr.c \
@abs_top_srcdir@/libsrc4/nc4info.c \
@abs_top_srcdir@/libsrc4/nc4dispatch.c \
@abs_top_srcdir@/examples/C/simple_xy_wr.c \
@abs_top_srcdir@/examples/C/simple_xy_rd.c \
@abs_top_srcdir@/examples/C/sfc_pres_temp_wr.c \

View File

@ -45,7 +45,7 @@ extern "C" {
#define NC_UINT64 11 /**< unsigned 8-byte int */
#define NC_STRING 12 /**< string */
#define NC_MAX_ATOMIC_TYPE NC_STRING
#define NC_MAX_ATOMIC_TYPE NC_STRING /**< @internal Largest atomic type. */
/* The following are use internally in support of user-defines
* types. They are also the class returned by nc_inq_user_type. */
@ -54,7 +54,8 @@ extern "C" {
#define NC_ENUM 15 /**< enum types */
#define NC_COMPOUND 16 /**< compound types */
/* Define the first user defined type id (leave some room) */
/** @internal Define the first user defined type id (leave some
* room) */
#define NC_FIRSTUSERTYPEID 32
/** Default fill value. This is used unless _FillValue attribute
@ -299,6 +300,9 @@ there. */
#define NC_SHUFFLE 1
/**@}*/
#define NC_MIN_DEFLATE_LEVEL 0 /**< Minimum deflate level. */
#define NC_MAX_DEFLATE_LEVEL 9 /**< Maximum deflate level. */
/** The netcdf version 3 functions all return integer error status.
* These are the possible values, in addition to certain values from
* the system errno.h.
@ -346,7 +350,7 @@ classic or 64-bit offset file, or an netCDF-4 file with
#define NC_ENAMEINUSE (-42) /**< String match to name in use */
#define NC_ENOTATT (-43) /**< Attribute not found */
#define NC_EMAXATTS (-44) /**< NC_MAX_ATTRS exceeded */ /* not enforced after 4.5.0 */
#define NC_EMAXATTS (-44) /**< NC_MAX_ATTRS exceeded - not enforced after 4.5.0 */
#define NC_EBADTYPE (-45) /**< Not a netcdf data type */
#define NC_EBADDIM (-46) /**< Invalid dimension id or name */
#define NC_EUNLIMPOS (-47) /**< NC_UNLIMITED in the wrong index */
@ -415,7 +419,7 @@ by the desired type. */
/* The following was added in support of netcdf-4. Make all netcdf-4
error codes < -100 so that errors can be added to netcdf-3 if
needed. */
#define NC4_FIRST_ERROR (-100)
#define NC4_FIRST_ERROR (-100) /**< @internal All HDF5 errors < this. */
#define NC_EHDFERR (-101) /**< Error at HDF5 layer. */
#define NC_ECANTREAD (-102) /**< Can't read. */
#define NC_ECANTWRITE (-103) /**< Can't write. */
@ -451,20 +455,20 @@ by the desired type. */
#define NC_EFILTER (-132) /**< Filter operation failed. */
#define NC_ERCFILE (-133) /**< RC file failure */
#define NC_ENULLPAD (-134) /**< Header Bytes not Null-Byte padded */
#define NC4_LAST_ERROR (-135)
#define NC4_LAST_ERROR (-135) /**< @internal All netCDF errors > this. */
/* This is used in netCDF-4 files for dimensions without coordinate
* vars. */
/** @internal This is used in netCDF-4 files for dimensions without
* coordinate vars. */
#define DIM_WITHOUT_VARIABLE "This is a netCDF dimension but not a netCDF variable."
/* This is here at the request of the NCO team to support our
* mistake of having chunksizes be first ints, then size_t. Doh! */
/** @internal This is here at the request of the NCO team to support
* our mistake of having chunksizes be first ints, then
* size_t. Doh! */
#define NC_HAVE_NEW_CHUNKING_API 1
/*Errors for all remote access methods(e.g. DAP and CDMREMOTE)*/
#define NC_EURL (NC_EDAPURL) /* Malformed URL */
#define NC_ECONSTRAINT (NC_EDAPCONSTRAINT) /* Malformed Constraint*/
/* Errors for all remote access methods(e.g. DAP and CDMREMOTE)*/
#define NC_EURL (NC_EDAPURL) /**< Malformed URL */
#define NC_ECONSTRAINT (NC_EDAPCONSTRAINT) /**< Malformed Constraint*/
/*
* The Interface
@ -479,10 +483,10 @@ by the desired type. */
# endif
# include <io.h>
#else
# define MSC_EXTRA
#define MSC_EXTRA /**< Needed for DLL build. */
#endif /* defined(DLL_NETCDF) */
# define EXTERNL MSC_EXTRA extern
#define EXTERNL MSC_EXTRA extern /**< Needed for DLL build. */
#if defined(DLL_NETCDF) /* define when library is a DLL */
EXTERNL int ncerr;
@ -1730,7 +1734,7 @@ nc_set_log_level(int new_level);
#else /* not LOGGING */
#define nc_set_log_level(e)
#define nc_set_log_level(e) /**< Get rid of these calls. */
#endif /* LOGGING */
@ -1810,27 +1814,27 @@ nctypelen(nc_type datatype);
*/
EXTERNL int ncerr;
#define NC_ENTOOL NC_EMAXNAME /* Backward compatibility */
#define NC_EXDR (-32) /* */
#define NC_SYSERR (-31)
#define NC_ENTOOL NC_EMAXNAME /**< Backward compatibility */
#define NC_EXDR (-32) /**< V2 API error. */
#define NC_SYSERR (-31) /**< V2 API system error. */
/*
* Global options variable.
* Used to determine behavior of error handler.
*/
#define NC_FATAL 1
#define NC_VERBOSE 2
#define NC_FATAL 1 /**< For V2 API, exit on error. */
#define NC_VERBOSE 2 /**< For V2 API, be verbose on error. */
EXTERNL int ncopts; /* default is (NC_FATAL | NC_VERBOSE) */
/** V2 API error handling. Default is (NC_FATAL | NC_VERBOSE). */
EXTERNL int ncopts;
EXTERNL void
nc_advise(const char *cdf_routine_name, int err, const char *fmt,...);
/*
* C data type corresponding to a netCDF NC_LONG argument,
* a signed 32 bit object.
*
* This is the only thing in this file which architecture dependent.
/**
* C data type corresponding to a netCDF NC_LONG argument, a signed 32
* bit object. This is the only thing in this file which architecture
* dependent.
*/
typedef int nclong;
@ -1958,11 +1962,6 @@ EXTERNL int nc_finalize();
}
#endif
/* Temporary hack to shut up warnings */
#ifndef __MINGW32_VERSION
#define END_OF_MAIN()
#endif
/* Define two hard-coded functionality-related
macros, but this is not going to be
standard practice. */
@ -1974,6 +1973,4 @@ EXTERNL int nc_finalize();
#define NC_HAVE_INQ_FORMAT_EXTENDED /*!< inq_format_extended() support. */
#endif
#define NC_HAVE_META_H
#endif /* _NETCDF_ */

View File

@ -1,11 +1,12 @@
/* Copyright 2010 University Corporation for Atmospheric
Research/Unidata. See COPYRIGHT file for more info.
This file has the var and att copy functions.
"$Id: copy.c,v 1.1 2010/06/01 15:46:49 ed Exp $"
/**
* @file
* Copyright 2010 University Corporation for Atmospheric
* Research/Unidata. See COPYRIGHT file for more info.
*
* This file has the var and att copy functions.
*
* @author Dennis Heimbigner
*/
#include "ncdispatch.h"
#include "nc_logging.h"
@ -229,25 +230,33 @@ NC_find_equal_type(int ncid1, nc_type xtype1, int ncid2, nc_type *xtype2)
#endif /* USE_NETCDF4 */
/* This will copy a variable that is an array of primitive type and
its attributes from one file to another, assuming dimensions in the
output file are already defined and have same dimension IDs and
length. However it doesn't work for copying netCDF-4 variables of
type string or a user-defined type.
This function works even if the files are different formats,
(for example, one netcdf classic, the other netcdf-4).
If you're copying into a classic-model file, from a netcdf-4 file,
you must be copying a variable of one of the six classic-model
types, and similarly for the attributes.
For large netCDF-3 files, this can be a very inefficient way to
copy data from one file to another, because adding a new variable
to the target file may require more space in the header and thus
result in moving data for other variables in the target file. This
is not a problem for netCDF-4 files, which support efficient
addition of variables without moving data for other variables.
/**
* This will copy a variable that is an array of primitive type and
* its attributes from one file to another, assuming dimensions in the
* output file are already defined and have same dimension IDs and
* length. However it doesn't work for copying netCDF-4 variables of
* type string or a user-defined type.
*
* This function works even if the files are different formats,
* (for example, one netcdf classic, the other netcdf-4).
*
* If you're copying into a classic-model file, from a netcdf-4 file,
* you must be copying a variable of one of the six classic-model
* types, and similarly for the attributes.
*
* For large netCDF-3 files, this can be a very inefficient way to
* copy data from one file to another, because adding a new variable
* to the target file may require more space in the header and thus
* result in moving data for other variables in the target file. This
* is not a problem for netCDF-4 files, which support efficient
* addition of variables without moving data for other variables.
*
* @param ncid_in File ID to copy from.
* @param varid_in Variable ID to copy.
* @param ncid_out File ID to copy to.
*
* @return ::NC_NOERR No error.
* @author Glenn Davis, Ed Hartnett, Dennis Heimbigner
*/
int
nc_copy_var(int ncid_in, int varid_in, int ncid_out)
@ -576,16 +585,26 @@ NC_copy_att(int ncid_in, int varid_in, const char *name,
return res;
}
/* Copy an attribute from one open file to another.
Special programming challenge: this function must work even if one
of the other of the files is a netcdf version 1.0 file (i.e. not
HDF5). So only use top level netcdf api functions.
From the netcdf-3 docs: The output netCDF dataset should be in
define mode if the attribute to be copied does not already exist
for the target variable, or if it would cause an existing target
attribute to grow.
/**
* Copy an attribute from one open file to another.
*
* Special programming challenge: this function must work even if one
* of the other of the files is a netcdf version 1.0 file (i.e. not
* HDF5). So only use top level netcdf api functions.
*
* From the netcdf-3 docs: The output netCDF dataset should be in
* define mode if the attribute to be copied does not already exist
* for the target variable, or if it would cause an existing target
* attribute to grow.
*
* @param ncid_in File ID to copy from.
* @param varid_in Variable ID to copy from.
* @param name Name of attribute to copy.
* @param ncid_out File ID to copy to.
* @param varid_out Variable ID to copy to.
*
* @return ::NC_NOERR No error.
* @author Glenn Davis, Ed Hartnett, Dennis Heimbigner
*/
int
nc_copy_att(int ncid_in, int varid_in, const char *name,

View File

@ -12,7 +12,7 @@ Research/Unidata. See COPYRIGHT file for more info.
#include <pnetcdf.h> /* for ncmpi_strerror() */
#endif
/* Tell the user the version of netCDF. */
/** @internal The version of netCDF. */
static const char nc_libvers[] = PACKAGE_VERSION " of "__DATE__" "__TIME__" $";
/**

View File

@ -1,12 +1,13 @@
/** \file dfile.c
File create and open functions
These functions end up calling functions in one of the dispatch layers
(netCDF-4, dap server, etc).
Copyright 2010 University Corporation for Atmospheric
Research/Unidata. See COPYRIGHT file for more info.
/**
* @file
*
* File create and open functions
*
* These functions end up calling functions in one of the dispatch
* layers (netCDF-4, dap server, etc).
*
* Copyright 2010 University Corporation for Atmospheric
* Research/Unidata. See COPYRIGHT file for more info.
*/
#include "config.h"
@ -52,10 +53,10 @@ static int closemagic(struct MagicFile* file);
static void printmagic(const char* tag, char* magic,struct MagicFile*);
#endif
extern int NC_initialized;
extern int NC_finalized;
extern int NC_initialized; /**< True when dispatch table is initialized. */
/* To be consistent with H5Fis_hdf5, use the complete HDF5 magic number */
/** @internal Magic number for HDF5 files. To be consistent with
* H5Fis_hdf5, use the complete HDF5 magic number */
static char HDF5_SIGNATURE[MAGIC_NUMBER_LEN] = "\211HDF\r\n\032\n";
/** \defgroup datasets NetCDF File and Data I/O
@ -158,11 +159,20 @@ done:
return status;
}
/*!
Given an existing file, figure out its format
and return that format value (NC_FORMATX_XXX)
in model arg. Assume any path conversion was
already performed at a higher level.
/**
* @internal Given an existing file, figure out its format and return
* that format value (NC_FORMATX_XXX) in model arg. Assume any path
* conversion was already performed at a higher level.
*
* @param path File name.
* @param flags
* @param parameters
* @param model Pointer that gets the model to use for the dispatch
* table.
* @param version Pointer that gets version of the file.
*
* @return ::NC_NOERR No error.
* @author Dennis Heimbigner
*/
int
NC_check_file_type(const char *path, int flags, void *parameters,
@ -445,63 +455,57 @@ nc_create(const char *path, int cmode, int *ncidp)
return nc__create(path,cmode,NC_SIZEHINT_DEFAULT,NULL,ncidp);
}
/*!
Create a netCDF file with some extra parameters controlling classic
file cacheing.
Like nc_create(), this function creates a netCDF file.
\param path The file name of the new netCDF dataset.
\param cmode The creation mode flag, the same as in nc_create().
\param initialsz On some systems, and with custom I/O layers, it may
be advantageous to set the size of the output file at creation
time. This parameter sets the initial size of the file at creation
time. This only applies to classic and 64-bit offset files.
The special value NC_SIZEHINT_DEFAULT (which is the value 0),
lets the netcdf library choose a suitable initial size.
\param chunksizehintp A pointer to the chunk size hint,
which controls a space versus time tradeoff, memory
allocated in the netcdf library versus number of system
calls. Because of internal requirements, the value may not
be set to exactly the value requested. The actual value
chosen is returned by reference. Using a NULL pointer or
having the pointer point to the value NC_SIZEHINT_DEFAULT
causes the library to choose a default. How the system
chooses the default depends on the system. On many systems,
the "preferred I/O block size" is available from the stat()
system call, struct stat member st_blksize. If this is
available it is used. Lacking that, twice the system
pagesize is used. Lacking a call to discover the system
pagesize, we just set default bufrsize to 8192. The bufrsize
is a property of a given open netcdf descriptor ncid, it is
not a persistent property of the netcdf dataset. This only
applies to classic and 64-bit offset files.
\param ncidp Pointer to location where returned netCDF ID is to be
stored.
\note This function uses the same return codes as the nc_create()
function.
\returns ::NC_NOERR No error.
\returns ::NC_ENOMEM System out of memory.
\returns ::NC_EHDFERR HDF5 error (netCDF-4 files only).
\returns ::NC_EFILEMETA Error writing netCDF-4 file-level metadata in
HDF5 file. (netCDF-4 files only).
\returns ::NC_EDISKLESS if there was an error in creating the
in-memory file.
<h1>Examples</h1>
In this example we create a netCDF dataset named foo_large.nc; we want
the dataset to be created in the current directory only if a dataset
with that name does not already exist. We also specify that bufrsize
and initial size for the file.
\code
/**
* Create a netCDF file with some extra parameters controlling classic
* file cacheing.
*
* Like nc_create(), this function creates a netCDF file.
*
* @param path The file name of the new netCDF dataset.
* @param cmode The creation mode flag, the same as in nc_create().
* @param initialsz On some systems, and with custom I/O layers, it
* may be advantageous to set the size of the output file at creation
* time. This parameter sets the initial size of the file at creation
* time. This only applies to classic and 64-bit offset files. The
* special value NC_SIZEHINT_DEFAULT (which is the value 0), lets the
* netcdf library choose a suitable initial size.
* @param chunksizehintp A pointer to the chunk size hint, which
* controls a space versus time tradeoff, memory allocated in the
* netcdf library versus number of system calls. Because of internal
* requirements, the value may not be set to exactly the value
* requested. The actual value chosen is returned by reference. Using
* a NULL pointer or having the pointer point to the value
* NC_SIZEHINT_DEFAULT causes the library to choose a default. How the
* system chooses the default depends on the system. On many systems,
* the "preferred I/O block size" is available from the stat() system
* call, struct stat member st_blksize. If this is available it is
* used. Lacking that, twice the system pagesize is used. Lacking a
* call to discover the system pagesize, we just set default bufrsize
* to 8192. The bufrsize is a property of a given open netcdf
* descriptor ncid, it is not a persistent property of the netcdf
* dataset. This only applies to classic and 64-bit offset files.
* @param ncidp Pointer to location where returned netCDF ID is to be
* stored.
*
* @note This function uses the same return codes as the nc_create()
* function.
*
* @returns ::NC_NOERR No error.
* @returns ::NC_ENOMEM System out of memory.
* @returns ::NC_EHDFERR HDF5 error (netCDF-4 files only).
* @returns ::NC_EFILEMETA Error writing netCDF-4 file-level metadata in
* HDF5 file. (netCDF-4 files only).
* @returns ::NC_EDISKLESS if there was an error in creating the
* in-memory file.
*
* <h1>Examples</h1>
*
* In this example we create a netCDF dataset named foo_large.nc; we
* want the dataset to be created in the current directory only if a
* dataset with that name does not already exist. We also specify that
* bufrsize and initial size for the file.
*
* @code
#include <netcdf.h>
...
int status = NC_NOERR;
@ -512,10 +516,10 @@ and initial size for the file.
*bufrsize = 1024;
status = nc__create("foo.nc", NC_NOCLOBBER, initialsz, bufrsize, &ncid);
if (status != NC_NOERR) handle_error(status);
\endcode
\ingroup datasets
\author Glenn Davis, Russ Rew, Dennis Heimbigner
@endcode
*
* @ingroup datasets
* @author Glenn Davis
*/
int
nc__create(const char *path, int cmode, size_t initialsz,
@ -526,12 +530,23 @@ nc__create(const char *path, int cmode, size_t initialsz,
}
/**
\internal
\deprecated This function was used in the old days with the Cray at
NCAR. The Cray is long gone, and this call is supported only for
backward compatibility.
* @internal Create a file with special (deprecated) Cray settings.
*
* @deprecated This function was used in the old days with the Cray at
* NCAR. The Cray is long gone, and this call is supported only for
* backward compatibility. Use nc_create() instead.
*
* @param path File name.
* @param cmode Create mode.
* @param initialsz Initial size of metadata region for classic files,
* ignored for other files.
* @param basepe Deprecated parameter from the Cray days.
* @param chunksizehintp A pointer to the chunk size hint. This only
* applies to classic and 64-bit offset files.
* @param ncidp Pointer that gets ncid.
*
* @return ::NC_NOERR No error.
* @author Glenn Davis
*/
int
nc__create_mp(const char *path, int cmode, size_t initialsz,
@ -541,119 +556,116 @@ nc__create_mp(const char *path, int cmode, size_t initialsz,
chunksizehintp, 0, NULL, ncidp);
}
/** \ingroup datasets
Open an existing netCDF file.
This function opens an existing netCDF dataset for access. It
determines the underlying file format automatically. Use the same call
to open a netCDF classic, 64-bit offset, or netCDF-4 file.
\param path File name for netCDF dataset to be opened. When DAP
support is enabled, then the path may be an OPeNDAP URL rather than a
file path.
\param mode The mode flag may include NC_WRITE (for read/write
access) and NC_SHARE (see below) and NC_DISKLESS (see below).
\param ncidp Pointer to location where returned netCDF ID is to be
stored.
<h2>Open Mode</h2>
A zero value (or ::NC_NOWRITE) specifies the default behavior: open the
dataset with read-only access, buffering and caching accesses for
efficiency.
Otherwise, the open mode is ::NC_WRITE, ::NC_SHARE, or
::NC_WRITE|::NC_SHARE. Setting the ::NC_WRITE flag opens the dataset with
read-write access. ("Writing" means any kind of change to the dataset,
including appending or changing data, adding or renaming dimensions,
variables, and attributes, or deleting attributes.)
The NC_SHARE flag is only used for netCDF classic and 64-bit offset
files. It is appropriate when one process may be writing the dataset
and one or more other processes reading the dataset concurrently; it
means that dataset accesses are not buffered and caching is
limited. Since the buffering scheme is optimized for sequential
access, programs that do not access data sequentially may see some
performance improvement by setting the NC_SHARE flag.
This procedure may also be invoked with the NC_DISKLESS flag
set in the mode argument if the file to be opened is a
classic format file. For nc_open(), this flag applies only
to files in classic format. If the file is of type
NC_NETCDF4, then the NC_DISKLESS flag will be ignored.
If NC_DISKLESS is specified, then the whole file is read completely into
memory. In effect this creates an in-memory cache of the file.
If the mode flag also specifies NC_WRITE, then the in-memory cache
will be re-written to the disk file when nc_close() is called.
For some kinds of manipulations, having the in-memory cache can
speed up file processing. But in simple cases, non-cached
processing may actually be faster than using cached processing.
You will need to experiment to determine if the in-memory caching
is worthwhile for your application.
Normally, NC_DISKLESS allocates space in the heap for
storing the in-memory file. If, however, the ./configure
flags --enable-mmap is used, and the additional mode flag
NC_MMAP is specified, then the file will be opened using
the operating system MMAP facility.
This flag only applies to files in classic format. Extended
format (netcdf-4) files will ignore the NC_MMAP flag.
In most cases, using MMAP provides no advantage
for just NC_DISKLESS. The one case where using MMAP is an
advantage is when a file is to be opened and only a small portion
of its data is to be read and/or written.
In this scenario, MMAP will cause only the accessed data to be
retrieved from disk. Without MMAP, NC_DISKLESS will read the whole
file into memory on nc_open. Thus, MMAP will provide some performance
improvement in this case.
It is not necessary to pass any information about the format of the
file being opened. The file type will be detected automatically by the
netCDF library.
If a the path is a DAP URL, then the open mode is read-only.
Setting NC_WRITE will be ignored.
As of version 4.3.1.2, multiple calls to nc_open with the same
path will return the same ncid value.
\note When opening a netCDF-4 file HDF5 error reporting is turned off,
if it is on. This doesn't stop the HDF5 error stack from recording the
errors, it simply stops their display to the user through stderr.
nc_open()returns the value NC_NOERR if no errors occurred. Otherwise,
the returned status indicates an error. Possible causes of errors
include:
Note that nc_open(path,cmode,ncidp) is equivalent to the invocation of
nc__open(path,cmode,NC_SIZEHINT_DEFAULT,NULL,ncidp).
\returns ::NC_NOERR No error.
\returns ::NC_ENOMEM Out of memory.
\returns ::NC_EHDFERR HDF5 error. (NetCDF-4 files only.)
\returns ::NC_EDIMMETA Error in netCDF-4 dimension metadata. (NetCDF-4 files only.)
<h1>Examples</h1>
Here is an example using nc_open()to open an existing netCDF dataset
named foo.nc for read-only, non-shared access:
@code
#include <netcdf.h>
...
int status = NC_NOERR;
int ncid;
...
status = nc_open("foo.nc", 0, &ncid);
if (status != NC_NOERR) handle_error(status);
@endcode
/**
* Open an existing netCDF file.
*
* This function opens an existing netCDF dataset for access. It
* determines the underlying file format automatically. Use the same
* call to open a netCDF classic, 64-bit offset, or netCDF-4 file.
*
* @param path File name for netCDF dataset to be opened. When DAP
* support is enabled, then the path may be an OPeNDAP URL rather than
* a file path.
* @param mode The mode flag may include NC_WRITE (for read/write
* access) and NC_SHARE (see below) and NC_DISKLESS (see below).
* @param ncidp Pointer to location where returned netCDF ID is to be
* stored.
*
* <h2>Open Mode</h2>
*
* A zero value (or ::NC_NOWRITE) specifies the default behavior: open
* the dataset with read-only access, buffering and caching accesses
* for efficiency.
*
* Otherwise, the open mode is ::NC_WRITE, ::NC_SHARE, or
* ::NC_WRITE|::NC_SHARE. Setting the ::NC_WRITE flag opens the
* dataset with read-write access. ("Writing" means any kind of change
* to the dataset, including appending or changing data, adding or
* renaming dimensions, variables, and attributes, or deleting
* attributes.)
*
* The NC_SHARE flag is only used for netCDF classic and 64-bit offset
* files. It is appropriate when one process may be writing the
* dataset and one or more other processes reading the dataset
* concurrently; it means that dataset accesses are not buffered and
* caching is limited. Since the buffering scheme is optimized for
* sequential access, programs that do not access data sequentially
* may see some performance improvement by setting the NC_SHARE flag.
*
* This procedure may also be invoked with the NC_DISKLESS flag set in
* the mode argument if the file to be opened is a classic format
* file. For nc_open(), this flag applies only to files in classic
* format. If the file is of type NC_NETCDF4, then the NC_DISKLESS
* flag will be ignored.
*
* If NC_DISKLESS is specified, then the whole file is read completely
* into memory. In effect this creates an in-memory cache of the file.
* If the mode flag also specifies NC_WRITE, then the in-memory cache
* will be re-written to the disk file when nc_close() is called. For
* some kinds of manipulations, having the in-memory cache can speed
* up file processing. But in simple cases, non-cached processing may
* actually be faster than using cached processing. You will need to
* experiment to determine if the in-memory caching is worthwhile for
* your application.
*
* Normally, NC_DISKLESS allocates space in the heap for storing the
* in-memory file. If, however, the ./configure flags --enable-mmap is
* used, and the additional mode flag NC_MMAP is specified, then the
* file will be opened using the operating system MMAP facility. This
* flag only applies to files in classic format. Extended format
* (netcdf-4) files will ignore the NC_MMAP flag.
*
* In most cases, using MMAP provides no advantage for just
* NC_DISKLESS. The one case where using MMAP is an advantage is when
* a file is to be opened and only a small portion of its data is to
* be read and/or written. In this scenario, MMAP will cause only the
* accessed data to be retrieved from disk. Without MMAP, NC_DISKLESS
* will read the whole file into memory on nc_open. Thus, MMAP will
* provide some performance improvement in this case.
*
* It is not necessary to pass any information about the format of the
* file being opened. The file type will be detected automatically by
* the netCDF library.
*
* If a the path is a DAP URL, then the open mode is read-only.
* Setting NC_WRITE will be ignored.
*
* As of version 4.3.1.2, multiple calls to nc_open with the same
* path will return the same ncid value.
*
* @note When opening a netCDF-4 file HDF5 error reporting is turned
* off, if it is on. This doesn't stop the HDF5 error stack from
* recording the errors, it simply stops their display to the user
* through stderr.
*
* nc_open()returns the value NC_NOERR if no errors
* occurred. Otherwise, the returned status indicates an
* error. Possible causes of errors include:
*
* Note that nc_open(path,cmode,ncidp) is equivalent to the invocation
* of nc__open(path,cmode,NC_SIZEHINT_DEFAULT,NULL,ncidp).
*
* @returns ::NC_NOERR No error.
* @returns ::NC_ENOMEM Out of memory.
* @returns ::NC_EHDFERR HDF5 error. (NetCDF-4 files only.)
* @returns ::NC_EDIMMETA Error in netCDF-4 dimension metadata. (NetCDF-4 files only.)
*
* <h1>Examples</h1>
*
* Here is an example using nc_open()to open an existing netCDF dataset
* named foo.nc for read-only, non-shared access:
*
* @code
* #include <netcdf.h>
* ...
* int status = NC_NOERR;
* int ncid;
* ...
* status = nc_open("foo.nc", 0, &ncid);
* if (status != NC_NOERR) handle_error(status);
* @endcode
* @ingroup datasets
* @author Glenn Davis, Ed Hartnett, Dennis Heimbigner
*/
int
nc_open(const char *path, int mode, int *ncidp)
@ -790,12 +802,22 @@ nc_open_mem(const char* path, int mode, size_t size, void* memory, int* ncidp)
}
/**
\internal
\deprecated This function was used in the old days with the Cray at
NCAR. The Cray is long gone, and this call is supported only for
backward compatibility.
* @internal Open a netCDF file with extra parameters for Cray.
*
* @deprecated This function was used in the old days with the Cray at
* NCAR. The Cray is long gone, and this call is supported only for
* backward compatibility. Use nc_open() instead.
*
* @param path The file name of the new netCDF dataset.
* @param mode Open mode.
* @param basepe Deprecated parameter from the Cray days.
* @param chunksizehintp A pointer to the chunk size hint. This only
* applies to classic and 64-bit offset files.
* @param ncidp Pointer to location where returned netCDF ID is to be
* stored.
*
* @return ::NC_NOERR
* @author Glenn Davis
*/
int
nc__open_mp(const char *path, int mode, int basepe,
@ -1362,15 +1384,18 @@ nc_set_fill(int ncid, int fillmode, int *old_modep)
}
/**
\internal
\deprecated This function was used in the old days with the Cray at
NCAR. The Cray is long gone, and this call is supported only for
backward compatibility.
\returns ::NC_NOERR No error.
\returns ::NC_EBADID Invalid ncid passed.
* @internal Learn base PE.
*
* @deprecated This function was used in the old days with the Cray at
* NCAR. The Cray is long gone, and this call is supported only for
* backward compatibility.
*
* @param ncid File and group ID.
* @param pe Pointer for base PE.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Invalid ncid passed.
* @author Glenn Davis
*/
int
nc_inq_base_pe(int ncid, int *pe)
@ -1382,15 +1407,18 @@ nc_inq_base_pe(int ncid, int *pe)
}
/**
\internal
\deprecated This function was used in the old days with the Cray at
NCAR. The Cray is long gone, and this call is supported only for
backward compatibility.
\returns ::NC_NOERR No error.
\returns ::NC_EBADID Invalid ncid passed.
* @internal Sets base processing element (ignored).
*
* @deprecated This function was used in the old days with the Cray at
* NCAR. The Cray is long gone, and this call is supported only for
* backward compatibility.
*
* @param ncid File ID.
* @param pe Base PE.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Invalid ncid passed.
* @author Glenn Davis
*/
int
nc_set_base_pe(int ncid, int pe)
@ -1516,6 +1544,16 @@ nc_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp)
return ncp->dispatch->inq(ncid,ndimsp,nvarsp,nattsp,unlimdimidp);
}
/**
* Learn the number of variables in a file or group.
*
* @param ncid File and group ID.
* @param nvarsp Pointer that gets number of variables. Ignored if NULL.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @author Glenn Davis, Ed Hartnett, Dennis Heimbigner
*/
int
nc_inq_nvars(int ncid, int *nvarsp)
{
@ -1615,37 +1653,31 @@ nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size)
}
/**
\internal
\ingroup dispatch
Create a file, calling the appropriate dispatch create call.
For create, we have the following pieces of information to use to
determine the dispatch table:
- path
- cmode
\param path0 The file name of the new netCDF dataset.
\param cmode The creation mode flag, the same as in nc_create().
\param initialsz This parameter sets the initial size of the file at creation
time. This only applies to classic and 64-bit offset files.
\param basepe Deprecated parameter from the Cray days.
\param chunksizehintp A pointer to the chunk size hint. This only
applies to classic and 64-bit offset files.
\param useparallel Non-zero if parallel I/O is to be used on this
file.
\param parameters Pointer to MPI comm and info.
\param ncidp Pointer to location where returned netCDF ID is to be
stored.
\returns ::NC_NOERR No error.
* @internal Create a file, calling the appropriate dispatch create
* call.
*
* For create, we have the following pieces of information to use to
* determine the dispatch table:
* - path
* - cmode
*
* @param path0 The file name of the new netCDF dataset.
* @param cmode The creation mode flag, the same as in nc_create().
* @param initialsz This parameter sets the initial size of the file
* at creation time. This only applies to classic and 64-bit offset
* files.
* @param basepe Deprecated parameter from the Cray days.
* @param chunksizehintp A pointer to the chunk size hint. This only
* applies to classic and 64-bit offset files.
* @param useparallel Non-zero if parallel I/O is to be used on this
* file.
* @param parameters Pointer to MPI comm and info.
* @param ncidp Pointer to location where returned netCDF ID is to be
* stored.
*
* @returns ::NC_NOERR No error.
* @ingroup dispatch
* @author Dennis Heimbigner, Ed Hartnett, Ward Fisher
*/
int
NC_create(const char *path0, int cmode, size_t initialsz,
@ -1813,25 +1845,31 @@ NC_create(const char *path0, int cmode, size_t initialsz,
}
/**
\internal
\ingroup dispatch
Open a netCDF file (or remote dataset) calling the appropriate
dispatch function.
For open, we have the following pieces of information to use to determine the dispatch table.
- table specified by override
- path
- cmode
- the contents of the file (if it exists), basically checking its magic number.
\returns ::NC_NOERR No error.
* @internal Open a netCDF file (or remote dataset) calling the
* appropriate dispatch function.
*
* For open, we have the following pieces of information to use to
* determine the dispatch table.
* - table specified by override
* - path
* - cmode
* - the contents of the file (if it exists), basically checking its magic number.
*
* @param path0 Path to the file to open.
* @param cmode Open mode.
* @param basepe Base processing element (ignored).
* @param chunksizehintp Size hint for classic files.
* @param useparallel If true use parallel I/O.
* @param parameters Extra parameters for the open.
* @param ncidp Pointer that gets ncid.
*
* @returns ::NC_NOERR No error.
* @ingroup dispatch
* @author Dennis Heimbigner
*/
int
NC_open(const char *path0, int cmode,
int basepe, size_t *chunksizehintp,
int useparallel, void* parameters,
int *ncidp)
NC_open(const char *path0, int cmode, int basepe, size_t *chunksizehintp,
int useparallel, void* parameters, int *ncidp)
{
int stat = NC_NOERR;
NC* ncp = NULL;
@ -2022,11 +2060,15 @@ havetable:
for systems that are not file based (e.g. dap, memio).
*/
/* Static counter for pseudo file descriptors (incremented) */
/** @internal Static counter for pseudo file descriptors (incremented) */
static int pseudofd = 0;
/* Create a pseudo file descriptor that does not
overlap real file descriptors
/**
* @internal Create a pseudo file descriptor that does not
* overlap real file descriptors
*
* @return pseudo file number
* @author Dennis Heimbigner
*/
int
nc__pseudofd(void)

View File

@ -30,10 +30,11 @@ documentation.
The V2 API is tested in test directory nctest.
*/
/* The subroutines in error.c emit no messages unless NC_VERBOSE bit
/** 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) ;
int ncerr = NC_NOERR ;
int ncerr = NC_NOERR ; /**< V2 API error code. */
#if SIZEOF_LONG == SIZEOF_SIZE_T
/*
@ -41,13 +42,15 @@ int ncerr = NC_NOERR ;
* to 'size_t' or 'ptrdiff_t'. Use dummy macros.
*/
# define NDIMS_DECL
# define NDIMS_DECL /**< NDIMS declaration */
/** @internal Declaration. */
# define A_DECL(name, type, ndims, rhs) \
const type *const name = ((const type *)(rhs))
# define A_FREE(name)
# define A_FREE(name) /**< Free a variable. */
# define A_INIT(lhs, type, ndims, rhs)
# define A_INIT(lhs, type, ndims, rhs) /**< Init a variable */
#else
/*
@ -115,11 +118,19 @@ static void* nvmalloc(off_t size) {
#endif
typedef signed char schar;
typedef signed char schar; /**< Signed character type. */
/*
/**
* Computes number of record variables in an open netCDF file, and an array of
* the record variable ids, if the array parameter is non-null.
*
* @param ncid File ID.
* @param nrecvarsp Pointer that gets number of record variables.
* @param recvarids Pointer that gets array of record variable IDs.
*
* @return ::NC_NOERR No error.
* @return -1 on error.
* @author Russ Rew
*/
static int
numrecvars(int ncid, int* nrecvarsp, int *recvarids)
@ -163,9 +174,15 @@ numrecvars(int ncid, int* nrecvarsp, int *recvarids)
}
/*
/**
* Computes record size (in bytes) of the record variable with a specified
* variable id. Returns size as 0 if not a record variable.
*
* @param ncid File ID.
* @param varid Variable ID.
* @param recsizep Pointer that gets record size.
*
* @return size, or 0 if not a record variable
*/
static int
ncrecsize(int ncid, int varid, size_t *recsizep)
@ -207,9 +224,17 @@ ncrecsize(int ncid, int varid, size_t *recsizep)
}
/*
/**
* Retrieves the dimension sizes of a variable with a specified variable id in
* an open netCDF file. Returns -1 on error.
* an open netCDF file.
*
* @param ncid File ID.
* @param varid Variable ID.
* @param sizes Pointer that gets sizes.
*
* @return ::NC_NOERR No error.
* @return -1 on error.
* @author Russ Rew
*/
static int
dimsizes(int ncid, int varid, size_t *sizes)

View File

@ -1049,6 +1049,18 @@ nc_def_var_endian(int ncid, int varid, int endian)
return ncp->dispatch->def_var_endian(ncid,varid,endian);
}
/**
* Define a new variable filter.
*
* @param ncid File and group ID.
* @param varid Variable ID.
* @param id
* @param nparams Number of filter parameters.
* @param parms Filter parameters.
*
* @return ::NC_NOERR No error.
* @author Dennis Heimbigner
*/
int
nc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int* parms)
{

View File

@ -25,13 +25,19 @@ struct GETodometer {
};
/** \internal
/**
* @internal Initialize odometer.
*
* @param odom Pointer to odometer.
* @param rank
* @param start Start indicies.
* @param edges Counts.
* @param stride Strides.
*
*/
static void
odom_init(struct GETodometer* odom,
int rank,
const size_t* start, const size_t* edges, const ptrdiff_t* stride)
odom_init(struct GETodometer* odom, int rank, const size_t* start,
const size_t* edges, const ptrdiff_t* stride)
{
int i;
memset(odom,0,sizeof(struct GETodometer));
@ -46,8 +52,12 @@ odom_init(struct GETodometer* odom,
}
}
/** \internal
/**
* @internal Return true if there is more.
*
* @param odom Pointer to odometer.
*
* @return True if there is more, 0 otherwise.
*/
static int
odom_more(struct GETodometer* odom)
@ -55,8 +65,12 @@ odom_more(struct GETodometer* odom)
return (odom->index[0] < odom->stop[0]);
}
/** \internal
/**
* @internal Move odometer.
*
* @param odom Pointer to odometer.
*
* @return 0 or 1
*/
static int
odom_next(struct GETodometer* odom)

View File

@ -18,10 +18,19 @@ struct PUTodometer {
size_t stop[NC_MAX_VAR_DIMS];
};
/**
* @internal Initialize odometer.
*
* @param odom Pointer to odometer.
* @param rank
* @param start Start indicies.
* @param edges Counts.
* @param stride Strides.
*
*/
static void
odom_init(struct PUTodometer* odom,
int rank,
const size_t* start, const size_t* edges, const ptrdiff_t* stride)
odom_init(struct PUTodometer* odom, int rank, const size_t* start,
const size_t* edges, const ptrdiff_t* stride)
{
int i;
memset(odom,0,sizeof(struct PUTodometer));
@ -36,12 +45,26 @@ odom_init(struct PUTodometer* odom,
}
}
/**
* @internal Return true if there is more.
*
* @param odom Pointer to odometer.
*
* @return True if there is more, 0 otherwise.
*/
static int
odom_more(struct PUTodometer* odom)
{
return (odom->index[0] < odom->stop[0]);
}
/**
* @internal Return true if there is more.
*
* @param odom Pointer to odometer.
*
* @return True if there is more, 0 otherwise.
*/
static int
odom_next(struct PUTodometer* odom)
{

View File

@ -2,23 +2,19 @@
# the COPYRIGHT file for more information.
# This automake file generates the Makefile to build netCDF-4.
# Ed Hartnett
include $(top_srcdir)/lib_flags.am
libnetcdf4_la_CPPFLAGS = ${AM_CPPFLAGS}
# This turns on declspec magic in netcdf.h for windows DLLs.
if BUILD_DLL
libnetcdf4_la_CPPFLAGS += -DDLL_EXPORT
endif
# This is our output. The netCDF-4 convenience library.
noinst_LTLIBRARIES = libnetcdf4.la
libnetcdf4_la_SOURCES = nc4dispatch.c nc4attr.c nc4dim.c \
nc4file.c nc4grp.c nc4hdf.c nc4internal.c nc4type.c nc4var.c ncfunc.c error4.c \
libnetcdf4_la_SOURCES = nc4dispatch.c nc4attr.c nc4dim.c nc4file.c \
nc4grp.c nc4hdf.c nc4internal.c nc4type.c nc4var.c ncfunc.c error4.c \
nc4info.c nc4printer.c
EXTRA_DIST=CMakeLists.txt
EXTRA_DIST = CMakeLists.txt

View File

@ -1,997 +0,0 @@
/*
* Copyright 1993-2011 University Corporation for Atmospheric
* Research/Unidata
*
*/
#include "config.h"
#include <stdlib.h>
#include "nc.h"
#ifndef MPI_INCLUDED
typedef int MPI_Comm;
typedef int MPI_Info;
#endif
int
nc3_create(const char *path, int cmode, size_t initialsz, int basepe,
size_t *chunksizehintp,
MPI_Comm comm, MPI_Info info,
NC** ncp) {abort();}
int
nc3_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
int use_parallel, MPI_Comm comm, MPI_Info info,
NC** ncp) {abort();}
int
nc3_redef(int ncid) {abort();}
int
nc3__enddef(int ncid, size_t h_minfree, size_t v_align,
size_t v_minfree, size_t r_align) {abort();}
int
nc3_sync(int ncid) {abort();}
int
nc3_abort(int ncid) {abort();}
int
nc3_close(int ncid) {abort();}
int
nc3_set_fill(int ncid, int fillmode, int *old_modep) {abort();}
int
nc3_set_base_pe(int ncid, int pe) {abort();}
int
nc3_inq_base_pe(int ncid, int *pe) {abort();}
int
nc3_inq_format(int ncid, int *formatp) {abort();}
int
nc3_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp) {abort();}
int
nc3_inq_type(int ncid, nc_type xtype,char* name,size_t* sizep) {abort();}
/* Begin _dim */
int
nc3_def_dim(int ncid, const char *name, size_t len, int *idp) {abort();}
int
nc3_inq_dimid(int ncid, const char *name, int *idp) {abort();}
int
nc3_inq_dim(int ncid, int dimid, char *name, size_t *lenp) {abort();}
int
nc3_rename_dim(int ncid, int dimid, const char *name) {abort();}
/* End _dim */
/* Begin _att */
int
nc3_inq_att(int ncid, int varid, const char *name,
nc_type *xtypep, size_t *lenp) {abort();}
int
nc3_inq_attid(int ncid, int varid, const char *name, int *idp) {abort();}
int
nc3_inq_attname(int ncid, int varid, int attnum, char *name) {abort();}
int
nc3_rename_att(int ncid, int varid, const char *name, const char *newname) {abort();}
int
nc3_del_att(int ncid, int varid, const char* name) {abort();}
/* End _att */
/* Begin {put,get}_att */
int
nc3_get_att(int ncid, int varid, const char *name, void *value, nc_type xtype) {abort();}
int
nc3_put_att(int ncid, int varid, const char *name, nc_type datatype,
size_t len, const void *value, nc_type xtype) {abort();}
/* End {put,get}_att */
/* Begin _var */
int
nc3_def_var(int ncid, const char *name,
nc_type xtype, int ndims, const int *dimidsp, int *varidp) {abort();}
int
nc3_inq_var(int ncid, int varid, char *name,
nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp) {abort();}
int
nc3_inq_varid(int ncid, const char *name, int *varidp) {abort();}
int
nc3_rename_var(int ncid, int varid, const char *name) {abort();}
int
nc3_put_vara(int ncid, int varid,
const size_t *start, const size_t *count,
const void *value, nc_type xtype) {abort();}
int
nc3_get_vara(int ncid, int varid,
const size_t *start, const size_t *count,
void *value, nc_type xtype) {abort();}
int
nc3_put_var(int ncid, int varid, const void *op) {abort();}
int
nc3_get_var(int ncid, int varid, void *ip) {abort();}
int
nc3_put_var1(int ncid, int varid, const size_t *indexp,
const void *op) {abort();}
int
nc3_get_var1(int ncid, int varid, const size_t *indexp, void *ip) {abort();}
int
nc3_put_vars(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const void *op) {abort();}
int
nc3_get_vars(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
void *ip) {abort();}
int
nc3_put_varm(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, const void *op) {abort();}
int
nc3_get_varm(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, void *ip) {abort();}
/* End _var */
/* netCDF4 API only */
int
nc3_var_par_access(int ncid,int varid,int pint) {abort();}
int
nc3_inq_ncid(int ncid,const char* pnm,int* pintp) {abort();}
int
nc3_inq_grps(int ncid,int* pintp,int* pintp2) {abort();}
int
nc3_inq_grpname(int ncid,char* pcharp) {abort();}
int
nc3_inq_grpname_full(int ncid,size_t* psize_tp,char* pcharp) {abort();}
int
nc3_inq_grp_parent(int ncid,int* pintp) {abort();}
int
nc3_inq_grp_full_ncid(int ncid,const char* pnm,int* pintp) {abort();}
int
nc3_inq_varids(int ncid,int* nvars,int* pintp) {abort();}
int
nc3_inq_dimids(int ncid,int* ndims,int* pintp,int pint) {abort();}
int
nc3_inq_typeids(int ncid,int* ntypes,int* pintp) {abort();}
int
nc3_inq_type_equal(int ncid,nc_type pnc_type,int pint,nc_type pnc_type2,int* pintp) {abort();}
int
nc3_def_grp(int ncid,const char* pnm,int* pintp) {abort();}
int
nc3_inq_user_type(int ncid,nc_type pnc_type,char* pnm,size_t* psize_tp,nc_type* pnc_typep,size_t* psize_tp2,int* pintp) {abort();}
int
nc3_def_compound(int ncid,size_t psize_t,const char* pnm,nc_type* pnc_typep) {abort();}
int
nc3_insert_compound(int ncid,nc_type pnc_type,const char* pnm,size_t psize_t,nc_type pnc_type2) {abort();}
int
nc3_insert_array_compound(int ncid,nc_type pnc_type,const char* pnm,size_t psize_t,nc_type pnc_type2,int pint,const int* pintp) {abort();}
int
nc3_inq_typeid(int ncid,const char* pnm,nc_type* pnc_typep) {abort();}
int
nc3_inq_compound_field(int ncid,nc_type pnc_type,int pint,char* pnm,size_t* psize_tp,nc_type* pnc_typep,int* pintp,int* pintp2) {abort();}
int
nc3_inq_compound_fieldindex(int ncid,nc_type pnc_type,const char* pnm,int* pintp) {abort();}
int
nc3_def_vlen(int ncid,const char* pnm,nc_type base_typeid,nc_type* pnc_typep) {abort();}
int
nc3_put_vlen_element(int ncid,int varid,void* pvoidp,size_t psize_t,const void* voidp) {abort();}
int
nc3_get_vlen_element(int ncid,int varid,const void* pvoidp,size_t* psize_tp,void* pvoidp2) {abort();}
int
nc3_def_enum(int ncid,nc_type pnc_type,const char* pnm,nc_type* pnc_typep) {abort();}
int
nc3_insert_enum(int ncid,nc_type pnc_type,const char* pnm,const void* voidp) {abort();}
int
nc3_inq_enum_member(int ncid,nc_type pnc_type,int pint,char* pnm,void* pvoidp) {abort();}
int
nc3_inq_enum_ident(int ncid,nc_type pnc_type,long long plonglong,char* pcharp) {abort();}
int
nc3_def_opaque(int ncid,size_t psize_t,const char* pnm,nc_type* pnc_typep) {abort();}
int
nc3_def_var_deflate(int ncid,int varid,int pint,int pint2,int pint3) {abort();}
int
nc3_inq_var_deflate(int ncid,int varid,int* pintp,int* pintp2,int* pintp3) {abort();}
int
nc3_inq_var_szip(int ncid,int varid,int* pintp,int* pintp2) {abort();}
int
nc3_def_var_fletcher32(int ncid,int varid,int pint) {abort();}
int
nc3_inq_var_fletcher32(int ncid,int varid,int* pintp) {abort();}
int
nc3_def_var_chunking(int ncid,int varid,int pint,const size_t* size_tp) {abort();}
int
nc3_inq_var_chunking(int ncid,int varid,int* pintp,size_t* psize_tp) {abort();}
int
nc3_def_var_fill(int ncid,int varid,int pint,const void* pvoidp) {abort();}
int
nc3_inq_var_fill(int ncid,int varid,int* pintp,void* pvoidp) {abort();}
int
nc3_def_var_endian(int ncid,int varid,int pint) {abort();}
int
nc3_inq_var_endian(int ncid,int varid,int* pintp) {abort();}
int
nc3_set_var_chunk_cache(int ncid,int varid,size_t psize_t,size_t psize_t2,float pfloat) {abort();}
int
nc3_get_var_chunk_cache(int ncid,int varid,size_t* psize_tp,size_t* psize_tp2, size_t* psize_tp3, float* pfloatp) {abort();}
int
nc3_inq_unlimdims(int ncid ,int* nump,int* dimsp) {abort();}
int
nc3_inq_unlimdim(int ncid, int *unlimdimidp) {abort();}
int
nc3_show_metadata(int ncid) {abort();}
int
nc3_put_att_text(int ncid, int varid, const char *name,
size_t len, const char *op) {abort();}
int
nc3_get_att_text(int ncid, int varid, const char *name, char *ip) {abort();}
int
nc3_put_att_uchar(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const unsigned char *op) {abort();}
int
nc3_get_att_uchar(int ncid, int varid, const char *name, unsigned char *ip) {abort();}
int
nc3_put_att_schar(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const signed char *op) {abort();}
int
nc3_get_att_schar(int ncid, int varid, const char *name, signed char *ip) {abort();}
int
nc3_put_att_short(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const short *op) {abort();}
int
nc3_get_att_short(int ncid, int varid, const char *name, short *ip) {abort();}
int
nc3_put_att_int(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const int *op) {abort();}
int
nc3_get_att_int(int ncid, int varid, const char *name, int *ip) {abort();}
int
nc3_put_att_long(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const long *op) {abort();}
int
nc3_get_att_long(int ncid, int varid, const char *name, long *ip) {abort();}
int
nc3_put_att_float(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const float *op) {abort();}
int
nc3_get_att_float(int ncid, int varid, const char *name, float *ip) {abort();}
int
nc3_put_att_double(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const double *op) {abort();}
int
nc3_get_att_double(int ncid, int varid, const char *name, double *ip) {abort();}
int
nc3_put_att_ubyte(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const unsigned char *op) {abort();}
int
nc3_get_att_ubyte(int ncid, int varid, const char *name,
unsigned char *ip) {abort();}
int
nc3_put_att_ushort(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const unsigned short *op) {abort();}
int
nc3_get_att_ushort(int ncid, int varid, const char *name, unsigned short *ip) {abort();}
int
nc3_put_att_uint(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const unsigned int *op) {abort();}
int
nc3_get_att_uint(int ncid, int varid, const char *name, unsigned int *ip) {abort();}
int
nc3_put_att_longlong(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const long long *op) {abort();}
int
nc3_get_att_longlong(int ncid, int varid, const char *name, long long *ip) {abort();}
int
nc3_put_att_ulonglong(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const unsigned long long *op) {abort();}
int
nc3_get_att_ulonglong(int ncid, int varid, const char *name,
unsigned long long *ip) {abort();}
int
nc3_put_att_string(int ncid, int varid, const char *name,
size_t len, const char **op) {abort();}
int
nc3_get_att_string(int ncid, int varid, const char *name, char **ip) {abort();}
int
nc3_put_var1_text(int ncid, int varid, const size_t *indexp, const char *op) {abort();}
int
nc3_get_var1_text(int ncid, int varid, const size_t *indexp, char *ip) {abort();}
int
nc3_put_var1_uchar(int ncid, int varid, const size_t *indexp,
const unsigned char *op) {abort();}
int
nc3_get_var1_uchar(int ncid, int varid, const size_t *indexp,
unsigned char *ip) {abort();}
int
nc3_put_var1_schar(int ncid, int varid, const size_t *indexp,
const signed char *op) {abort();}
int
nc3_get_var1_schar(int ncid, int varid, const size_t *indexp,
signed char *ip) {abort();}
int
nc3_put_var1_short(int ncid, int varid, const size_t *indexp,
const short *op) {abort();}
int
nc3_get_var1_short(int ncid, int varid, const size_t *indexp,
short *ip) {abort();}
int
nc3_put_var1_int(int ncid, int varid, const size_t *indexp, const int *op) {abort();}
int
nc3_get_var1_int(int ncid, int varid, const size_t *indexp, int *ip) {abort();}
int
nc3_put_var1_long(int ncid, int varid, const size_t *indexp, const long *op) {abort();}
int
nc3_get_var1_long(int ncid, int varid, const size_t *indexp, long *ip) {abort();}
int
nc3_put_var1_float(int ncid, int varid, const size_t *indexp, const float *op) {abort();}
int
nc3_get_var1_float(int ncid, int varid, const size_t *indexp, float *ip) {abort();}
int
nc3_put_var1_double(int ncid, int varid, const size_t *indexp, const double *op) {abort();}
int
nc3_get_var1_double(int ncid, int varid, const size_t *indexp, double *ip) {abort();}
int
nc3_put_var1_ubyte(int ncid, int varid, const size_t *indexp,
const unsigned char *op) {abort();}
int
nc3_get_var1_ubyte(int ncid, int varid, const size_t *indexp,
unsigned char *ip) {abort();}
int
nc3_put_var1_ushort(int ncid, int varid, const size_t *indexp,
const unsigned short *op) {abort();}
int
nc3_get_var1_ushort(int ncid, int varid, const size_t *indexp,
unsigned short *ip) {abort();}
int
nc3_put_var1_uint(int ncid, int varid, const size_t *indexp,
const unsigned int *op) {abort();}
int
nc3_get_var1_uint(int ncid, int varid, const size_t *indexp,
unsigned int *ip) {abort();}
int
nc3_put_var1_longlong(int ncid, int varid, const size_t *indexp,
const long long *op) {abort();}
int
nc3_get_var1_longlong(int ncid, int varid, const size_t *indexp,
long long *ip) {abort();}
int
nc3_put_var1_ulonglong(int ncid, int varid, const size_t *indexp,
const unsigned long long *op) {abort();}
int
nc3_get_var1_ulonglong(int ncid, int varid, const size_t *indexp,
unsigned long long *ip) {abort();}
int
nc3_put_var1_string(int ncid, int varid, const size_t *indexp,
const char **op) {abort();}
int
nc3_get_var1_string(int ncid, int varid, const size_t *indexp,
char **ip) {abort();}
/* End {put,get}_var1 */
/* Begin {put,get}_vara */
int
nc3_put_vara_text(int ncid, int varid,
const size_t *startp, const size_t *countp, const char *op) {abort();}
int
nc3_get_vara_text(int ncid, int varid,
const size_t *startp, const size_t *countp, char *ip) {abort();}
int
nc3_put_vara_uchar(int ncid, int varid,
const size_t *startp, const size_t *countp, const unsigned char *op) {abort();}
int
nc3_get_vara_uchar(int ncid, int varid, const size_t *startp,
const size_t *countp, unsigned char *ip) {abort();}
int
nc3_put_vara_schar(int ncid, int varid, const size_t *startp,
const size_t *countp, const signed char *op) {abort();}
int
nc3_get_vara_schar(int ncid, int varid, const size_t *startp,
const size_t *countp, signed char *ip) {abort();}
int
nc3_put_vara_short(int ncid, int varid, const size_t *startp,
const size_t *countp, const short *op) {abort();}
int
nc3_get_vara_short(int ncid, int varid, const size_t *startp,
const size_t *countp, short *ip) {abort();}
int
nc3_put_vara_int(int ncid, int varid, const size_t *startp,
const size_t *countp, const int *op) {abort();}
int
nc3_get_vara_int(int ncid, int varid, const size_t *startp,
const size_t *countp, int *ip) {abort();}
int
nc3_put_vara_long(int ncid, int varid, const size_t *startp,
const size_t *countp, const long *op) {abort();}
int
nc3_get_vara_long(int ncid, int varid,
const size_t *startp, const size_t *countp, long *ip) {abort();}
int
nc3_put_vara_float(int ncid, int varid,
const size_t *startp, const size_t *countp, const float *op) {abort();}
int
nc3_get_vara_float(int ncid, int varid,
const size_t *startp, const size_t *countp, float *ip) {abort();}
int
nc3_put_vara_double(int ncid, int varid, const size_t *startp,
const size_t *countp, const double *op) {abort();}
int
nc3_get_vara_double(int ncid, int varid, const size_t *startp,
const size_t *countp, double *ip) {abort();}
int
nc3_put_vara_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned char *op) {abort();}
int
nc3_get_vara_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, unsigned char *ip) {abort();}
int
nc3_put_vara_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned short *op) {abort();}
int
nc3_get_vara_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, unsigned short *ip) {abort();}
int
nc3_put_vara_uint(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned int *op) {abort();}
int
nc3_get_vara_uint(int ncid, int varid, const size_t *startp,
const size_t *countp, unsigned int *ip) {abort();}
int
nc3_put_vara_longlong(int ncid, int varid, const size_t *startp,
const size_t *countp, const long long *op) {abort();}
int
nc3_get_vara_longlong(int ncid, int varid, const size_t *startp,
const size_t *countp, long long *ip) {abort();}
int
nc3_put_vara_ulonglong(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned long long *op) {abort();}
int
nc3_get_vara_ulonglong(int ncid, int varid, const size_t *startp,
const size_t *countp, unsigned long long *ip) {abort();}
int
nc3_put_vara_string(int ncid, int varid, const size_t *startp,
const size_t *countp, const char **op) {abort();}
int
nc3_get_vara_string(int ncid, int varid, const size_t *startp,
const size_t *countp, char **ip) {abort();}
/* End {put,get}_vara */
/* Begin {put,get}_vars */
int
nc3_put_vars_text(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
const char *op) {abort();}
int
nc3_get_vars_text(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
char *ip) {abort();}
int
nc3_put_vars_uchar(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
const unsigned char *op) {abort();}
int
nc3_get_vars_uchar(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
unsigned char *ip) {abort();}
int
nc3_put_vars_schar(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
const signed char *op) {abort();}
int
nc3_get_vars_schar(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
signed char *ip) {abort();}
int
nc3_put_vars_short(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
const short *op) {abort();}
int
nc3_get_vars_short(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
short *ip) {abort();}
int
nc3_put_vars_int(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
const int *op) {abort();}
int
nc3_get_vars_int(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
int *ip) {abort();}
int
nc3_put_vars_long(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
const long *op) {abort();}
int
nc3_get_vars_long(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
long *ip) {abort();}
int
nc3_put_vars_float(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
const float *op) {abort();}
int
nc3_get_vars_float(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
float *ip) {abort();}
int
nc3_put_vars_double(int ncid, int varid,
const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
const double *op) {abort();}
int
nc3_get_vars_double(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
double *ip) {abort();}
int
nc3_put_vars_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const unsigned char *op) {abort();}
int
nc3_get_vars_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
unsigned char *ip) {abort();}
int
nc3_put_vars_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const unsigned short *op) {abort();}
int
nc3_get_vars_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
unsigned short *ip) {abort();}
int
nc3_put_vars_uint(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const unsigned int *op) {abort();}
int
nc3_get_vars_uint(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
unsigned int *ip) {abort();}
int
nc3_put_vars_longlong(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const long long *op) {abort();}
int
nc3_get_vars_longlong(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
long long *ip) {abort();}
int
nc3_put_vars_ulonglong(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const unsigned long long *op) {abort();}
int
nc3_get_vars_ulonglong(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
unsigned long long *ip) {abort();}
int
nc3_put_vars_string(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const char **op) {abort();}
int
nc3_get_vars_string(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
char **ip) {abort();}
/* End {put,get}_vars */
/* Begin {put,get}_varm */
int
nc3_put_varm_text(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, const char *op) {abort();}
int
nc3_get_varm_text(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, char *ip) {abort();}
int
nc3_put_varm_uchar(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, const unsigned char *op) {abort();}
int
nc3_get_varm_uchar(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, unsigned char *ip) {abort();}
int
nc3_put_varm_schar(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, const signed char *op) {abort();}
int
nc3_get_varm_schar(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, signed char *ip) {abort();}
int
nc3_put_varm_short(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, const short *op) {abort();}
int
nc3_get_varm_short(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, short *ip) {abort();}
int
nc3_put_varm_int(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, const int *op) {abort();}
int
nc3_get_varm_int(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, int *ip) {abort();}
int
nc3_put_varm_long(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, const long *op) {abort();}
int
nc3_get_varm_long(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, long *ip) {abort();}
int
nc3_put_varm_float(int ncid, int varid,const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, const float *op) {abort();}
int
nc3_get_varm_float(int ncid, int varid,const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, float *ip) {abort();}
int
nc3_put_varm_double(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, const double *op) {abort();}
int
nc3_get_varm_double(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, double *ip) {abort();}
int
nc3_put_varm_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, const unsigned char *op) {abort();}
int
nc3_get_varm_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, unsigned char *ip) {abort();}
int
nc3_put_varm_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, const unsigned short *op) {abort();}
int
nc3_get_varm_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, unsigned short *ip) {abort();}
int
nc3_put_varm_uint(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, const unsigned int *op) {abort();}
int
nc3_get_varm_uint(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, unsigned int *ip) {abort();}
int
nc3_put_varm_longlong(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, const long long *op) {abort();}
int
nc3_get_varm_longlong(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, long long *ip) {abort();}
int
nc3_put_varm_ulonglong(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, const unsigned long long *op) {abort();}
int
nc3_get_varm_ulonglong(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, unsigned long long *ip) {abort();}
int
nc3_put_varm_string(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, const char **op) {abort();}
int
nc3_get_varm_string(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, char **ip) {abort();}
/* End {put,get}_varm */
/* Begin {put,get}_var */
int
nc3_put_var_text(int ncid, int varid, const char *op) {abort();}
int
nc3_get_var_text(int ncid, int varid, char *ip) {abort();}
int
nc3_put_var_uchar(int ncid, int varid, const unsigned char *op) {abort();}
int
nc3_get_var_uchar(int ncid, int varid, unsigned char *ip) {abort();}
int
nc3_put_var_schar(int ncid, int varid, const signed char *op) {abort();}
int
nc3_get_var_schar(int ncid, int varid, signed char *ip) {abort();}
int
nc3_put_var_short(int ncid, int varid, const short *op) {abort();}
int
nc3_get_var_short(int ncid, int varid, short *ip) {abort();}
int
nc3_put_var_int(int ncid, int varid, const int *op) {abort();}
int
nc3_get_var_int(int ncid, int varid, int *ip) {abort();}
int
nc3_put_var_long(int ncid, int varid, const long *op) {abort();}
int
nc3_get_var_long(int ncid, int varid, long *ip) {abort();}
int
nc3_put_var_float(int ncid, int varid, const float *op) {abort();}
int
nc3_get_var_float(int ncid, int varid, float *ip) {abort();}
int
nc3_put_var_double(int ncid, int varid, const double *op) {abort();}
int
nc3_get_var_double(int ncid, int varid, double *ip) {abort();}
int
nc3_put_var_ubyte(int ncid, int varid, const unsigned char *op) {abort();}
int
nc3_get_var_ubyte(int ncid, int varid, unsigned char *ip) {abort();}
int
nc3_put_var_ushort(int ncid, int varid, const unsigned short *op) {abort();}
int
nc3_get_var_ushort(int ncid, int varid, unsigned short *ip) {abort();}
int
nc3_put_var_uint(int ncid, int varid, const unsigned int *op) {abort();}
int
nc3_get_var_uint(int ncid, int varid, unsigned int *ip) {abort();}
int
nc3_put_var_longlong(int ncid, int varid, const long long *op) {abort();}
int
nc3_get_var_longlong(int ncid, int varid, long long *ip) {abort();}
int
nc3_put_var_ulonglong(int ncid, int varid, const unsigned long long *op) {abort();}
int
nc3_get_var_ulonglong(int ncid, int varid, unsigned long long *ip) {abort();}
int
nc3_put_var_string(int ncid, int varid, const char **op) {abort();}
int
nc3_get_var_string(int ncid, int varid, char **ip) {abort();}
int
nc3__create_mp(const char *path, int cmode, size_t initialsz, int basepe,
size_t *chunksizehintp, int *ncidp) {abort();}
int
nc3__open_mp(const char *path, int mode, int basepe,
size_t *chunksizehintp, int *ncidp) {abort();}
int
nc3_enddef(int ncid) {abort();}

View File

@ -21,11 +21,77 @@
#include "nc4dispatch.h"
#include "ncdispatch.h"
static int nc4_get_att_special(NC_HDF5_FILE_INFO_T*, const char*,
nc_type*, nc_type, size_t*, int*, int, void*);
int nc4typelen(nc_type type);
/**
* @internal Get special informatation about the attrobute.
*
* @param h5 Pointer to HDF5 file info struct.
* @param name Name of attribute.
* @param filetypep Pointer that gets type of the attribute data in
* file.
* @param mem_type Type of attribute data in memory.
* @param lenp Pointer that gets length of attribute array.
* @param attnump Pointer that gets the attribute number.
* @param is_long True if attribute data is of type NC_LONG.
* @param data Attribute data.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @author Dennis Heimbigner
*/
static int
nc4_get_att_special(NC_HDF5_FILE_INFO_T* h5, const char* name,
nc_type* filetypep, nc_type mem_type, size_t* lenp,
int* attnump, int is_long, void* data)
{
/* Fail if asking for att id */
if(attnump)
return NC_EATTMETA;
if(strcmp(name,NCPROPS)==0) {
char* propdata = NULL;
int stat = NC_NOERR;
int len;
if(h5->fileinfo->propattr.version == 0)
return NC_ENOTATT;
if(mem_type == NC_NAT) mem_type = NC_CHAR;
if(mem_type != NC_CHAR)
return NC_ECHAR;
if(filetypep) *filetypep = NC_CHAR;
stat = NC4_buildpropinfo(&h5->fileinfo->propattr, &propdata);
if(stat != NC_NOERR) return stat;
len = strlen(propdata);
if(lenp) *lenp = len;
if(data) strncpy((char*)data,propdata,len+1);
free(propdata);
} else if(strcmp(name,ISNETCDF4ATT)==0
|| strcmp(name,SUPERBLOCKATT)==0) {
unsigned long long iv = 0;
if(filetypep) *filetypep = NC_INT;
if(lenp) *lenp = 1;
if(strcmp(name,SUPERBLOCKATT)==0)
iv = (unsigned long long)h5->fileinfo->superblockversion;
else /* strcmp(name,ISNETCDF4ATT)==0 */
iv = NC4_isnetcdf4(h5);
if(mem_type == NC_NAT) mem_type = NC_INT;
if(data)
switch (mem_type) {
case NC_BYTE: *((char*)data) = (char)iv; break;
case NC_SHORT: *((short*)data) = (short)iv; break;
case NC_INT: *((int*)data) = (int)iv; break;
case NC_UBYTE: *((unsigned char*)data) = (unsigned char)iv; break;
case NC_USHORT: *((unsigned short*)data) = (unsigned short)iv; break;
case NC_UINT: *((unsigned int*)data) = (unsigned int)iv; break;
case NC_INT64: *((long long*)data) = (long long)iv; break;
case NC_UINT64: *((unsigned long long*)data) = (unsigned long long)iv; break;
default:
return NC_ERANGE;
}
}
return NC_NOERR;
}
/**
* @internal Get or put attribute metadata from our linked list of
* file info. Always locate the attribute by name, never by attnum.
@ -605,8 +671,8 @@ exit:
* @param ncid File and group ID.
* @param varid Variable ID.
* @param name Name of attribute.
* @param xtype Pointer that gets type of attribute.
* @oaram lenp Pointer that gets length of attribute data array.
* @param xtypep Pointer that gets type of attribute.
* @param lenp Pointer that gets length of attribute data array.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
@ -1002,74 +1068,6 @@ nc4_put_att_tc(int ncid, int varid, const char *name, nc_type file_type,
mem_type_is_long, op);
}
/**
* @internal Get special informatation about the attrobute.
*
* @param h5 Pointer to HDF5 file info struct.
* @param name Name of attribute.
* @param filetypep Pointer that gets type of the attribute data in
* file.
* @param mem_type Type of attribute data in memory.
* @param len Length of attribute array.
* @param is_long True if attribute data is of type NC_LONG.
* @param data Attribute data.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @author Dennis Heimbigner
*/
static int
nc4_get_att_special(NC_HDF5_FILE_INFO_T* h5, const char* name,
nc_type* filetypep, nc_type mem_type, size_t* lenp,
int* attnump, int is_long, void* data)
{
/* Fail if asking for att id */
if(attnump)
return NC_EATTMETA;
if(strcmp(name,NCPROPS)==0) {
char* propdata = NULL;
int stat = NC_NOERR;
int len;
if(h5->fileinfo->propattr.version == 0)
return NC_ENOTATT;
if(mem_type == NC_NAT) mem_type = NC_CHAR;
if(mem_type != NC_CHAR)
return NC_ECHAR;
if(filetypep) *filetypep = NC_CHAR;
stat = NC4_buildpropinfo(&h5->fileinfo->propattr, &propdata);
if(stat != NC_NOERR) return stat;
len = strlen(propdata);
if(lenp) *lenp = len;
if(data) strncpy((char*)data,propdata,len+1);
free(propdata);
} else if(strcmp(name,ISNETCDF4ATT)==0
|| strcmp(name,SUPERBLOCKATT)==0) {
unsigned long long iv = 0;
if(filetypep) *filetypep = NC_INT;
if(lenp) *lenp = 1;
if(strcmp(name,SUPERBLOCKATT)==0)
iv = (unsigned long long)h5->fileinfo->superblockversion;
else /* strcmp(name,ISNETCDF4ATT)==0 */
iv = NC4_isnetcdf4(h5);
if(mem_type == NC_NAT) mem_type = NC_INT;
if(data)
switch (mem_type) {
case NC_BYTE: *((char*)data) = (char)iv; break;
case NC_SHORT: *((short*)data) = (short)iv; break;
case NC_INT: *((int*)data) = (int)iv; break;
case NC_UBYTE: *((unsigned char*)data) = (unsigned char)iv; break;
case NC_USHORT: *((unsigned short*)data) = (unsigned short)iv; break;
case NC_UINT: *((unsigned int*)data) = (unsigned int)iv; break;
case NC_INT64: *((long long*)data) = (long long)iv; break;
case NC_UINT64: *((unsigned long long*)data) = (unsigned long long)iv; break;
default:
return NC_ERANGE;
}
}
return NC_NOERR;
}
/**
* @internal Read an attribute of any type, with type conversion. This
* may be called by any of the nc_get_att_* functions.

View File

@ -22,7 +22,7 @@
* @note that this code is inconsistent with nc_inq
*
* @param ncid File and group ID.
* @param unlimdimidsp Pointer that gets ID of first unlimited
* @param unlimdimidp Pointer that gets ID of first unlimited
* dimension, or -1.
*
* @return ::NC_NOERR No error.

View File

@ -102,6 +102,12 @@ NC4_get_var_chunk_cache,
NC_Dispatch* NC4_dispatch_table = NULL; /* moved here from ddispatch.c */
/**
* @internal Initialize netCDF-4.
*
* @return ::NC_NOERR No error.
* @author Dennis Heimbigner
*/
int
NC4_initialize(void)
{
@ -109,6 +115,12 @@ NC4_initialize(void)
return NC_NOERR;
}
/**
* @internal Finalize netCDF-4.
*
* @return ::NC_NOERR No error.
* @author Dennis Heimbigner
*/
int
NC4_finalize(void)
{

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@
* @param new_ncid Pointer that gets ncid for new group.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_ESTRICTNC3 Classic model in use for this file.
* @return ::NC_ENOTNC4 Not a netCDF-4 file.
* @author Ed Hartnett
@ -81,10 +82,12 @@ NC4_def_grp(int parent_ncid, const char *name, int *new_ncid)
* @param name New name for group.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_ENOTNC4 Not a netCDF-4 file.
* @return ::NC_EPERM File opened read-only.
* @return ::NC_EBADGRPID Renaming root forbidden.
* @return ::NC_EHDFERR HDF5 function returned error.
* @return ::NC_ENOMEM Out of memory.
* @author Ed Hartnett
*/
int
@ -160,8 +163,12 @@ NC4_rename_grp(int grpid, const char *name)
*
* @param ncid File and group ID.
* @param name Pointer that gets name.
* @param grp_ncid Pointer that gets group ncid.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_ENOTNC4 Not a netCDF-4 file.
* @return ::NC_ENOGRP Group not found.
* @author Ed Hartnett
*/
int
@ -204,8 +211,11 @@ NC4_inq_ncid(int ncid, const char *name, int *grp_ncid)
* contains, and an array of their locids.
*
* @param ncid File and group ID.
* @param numgrps Pointer that gets number of groups. Ignored if NULL.
* @param ncids Pointer that gets array of ncids. Ignored if NULL.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @author Ed Hartnett
*/
int
@ -258,6 +268,7 @@ NC4_inq_grps(int ncid, int *numgrps, int *ncids)
* @param name Pointer that gets name.
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @author Ed Hartnett
*/
int
@ -294,6 +305,8 @@ NC4_inq_grpname(int ncid, char *name)
* @param full_name Pointer that gets name.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_ENOMEM Out of memory.
* @author Ed Hartnett
*/
int
@ -348,6 +361,7 @@ NC4_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
return ret;
}
/**
* @internal Find the parent ncid of a group. For the root group,
* return NC_ENOGRP error. *Now* I know what kind of tinfoil hat
@ -355,7 +369,11 @@ NC4_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
* parent_ncid - Russ Rew!!
*
* @param ncid File and group ID.
* @param parent_ncid Pointer that gets the ncid of parent group.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_ENOGRP Root has no parent.
* @author Ed Hartnett
*/
int
@ -391,7 +409,14 @@ NC4_inq_grp_parent(int ncid, int *parent_ncid)
* @internal Given a full name and ncid, find group ncid.
*
* @param ncid File and group ID.
* @param full_name Full name of group.
* @param grp_ncid Pointer that gets ncid of group.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_ENOGRP Group not found.
* @return ::NC_ENOMEM Out of memory.
* @return ::NC_EINVAL Name is required.
* @author Ed Hartnett
*/
int
@ -456,7 +481,11 @@ NC4_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid)
* @internal Get a list of ids for all the variables in a group.
*
* @param ncid File and group ID.
* @param nvars Pointer that gets number of vars in group.
* @param varids Pointer that gets array of var IDs.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @author Ed Hartnett
*/
int
@ -531,8 +560,13 @@ int int_cmp(const void *a, const void *b)
* parameter.
*
* @param ncid File and group ID.
* @param ndims Pointer that gets number of dimensions available in group.
* @param dimids Pointer that gets dim IDs.
* @param include_parents If non-zero, include dimensions from parent
* groups.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @author Ed Hartnett
*/
int

View File

@ -25,9 +25,15 @@
#include "netcdf_par.h"
#endif
#define NC3_STRICT_ATT_NAME "_nc3_strict"
#define NC3_STRICT_ATT_NAME "_nc3_strict" /**< @internal Indicates classic model. */
#define NC_HDF5_MAX_NAME 1024
#define NC_HDF5_MAX_NAME 1024 /**< @internal Max size of HDF5 name. */
#define MAXNAME 1024 /**< Max HDF5 name. */
/** @internal HDF5 object types. */
static unsigned int OTYPES[5] = {H5F_OBJ_FILE, H5F_OBJ_DATASET, H5F_OBJ_GROUP,
H5F_OBJ_DATATYPE, H5F_OBJ_ATTR};
/**
* @internal Flag attributes in a linked list as dirty.
@ -527,8 +533,14 @@ exit:
/**
* @internal Do some common check for nc4_put_vara and
* nc4_get_vara. These checks have to be done when both reading and
* writing data.
* writing data.
*
* @param mem_nc_type Pointer to type of data in memory.
* @param var Pointer to var info struct.
* @param h5 Pointer to HDF5 file info struct.
*
* @return ::NC_NOERR No error.
* @author Ed Hartnett
*/
static int
check_for_vara(nc_type *mem_nc_type, NC_VAR_INFO_T *var, NC_HDF5_FILE_INFO_T *h5)
@ -1504,7 +1516,17 @@ exit:
return retval;
}
/* Write all the dirty atts in an attlist. */
/**
* @internal Write all the dirty atts in an attlist.
*
* @param attlist Pointer to the list if attributes.
* @param varid Variable ID.
* @param grp Pointer to group info struct.
*
* @returns NC_NOERR No error.
* @returns NC_EHDFERR HDF5 returned an error.
* @author Ed Hartnett
*/
static int
write_attlist(NC_ATT_INFO_T *attlist, int varid, NC_GRP_INFO_T *grp)
{
@ -1526,16 +1548,24 @@ write_attlist(NC_ATT_INFO_T *attlist, int varid, NC_GRP_INFO_T *grp)
}
/* This function is a bit of a hack. Turns out that HDF5 dimension
* scales cannot themselves have scales attached. This leaves
* multidimensional coordinate variables hosed. So this function
* writes a special attribute for such a variable, which has the ids
* of all the dimensions for that coordinate variable. This sucks,
* really. But that's the way the cookie crumbles. Better luck next
* time. This function also contains a new way of dealing with HDF5
* error handling, abandoning the BAIL macros for a more organic and
* natural approach, made with whole grains, and locally-grown
* vegetables. */
/**
* @internal This function is a bit of a hack. Turns out that HDF5
* dimension scales cannot themselves have scales attached. This
* leaves multidimensional coordinate variables hosed. So this
* function writes a special attribute for such a variable, which has
* the ids of all the dimensions for that coordinate variable. This
* sucks, really. But that's the way the cookie crumbles. Better luck
* next time. This function also contains a new way of dealing with
* HDF5 error handling, abandoning the BAIL macros for a more organic
* and natural approach, made with whole grains, and locally-grown
* vegetables.
*
* @param var Pointer to var info struct.
*
* @returns NC_NOERR No error.
* @returns NC_EHDFERR HDF5 returned an error.
* @author Ed Hartnett
*/
static int
write_coord_dimids(NC_VAR_INFO_T *var)
{
@ -1556,7 +1586,16 @@ write_coord_dimids(NC_VAR_INFO_T *var)
return ret ? NC_EHDFERR : 0;
}
/* Write a special attribute for the netCDF-4 dimension ID. */
/**
* @internal Write a special attribute for the netCDF-4 dimension ID.
*
* @param datasetid HDF5 datasset ID.
* @param dimid NetCDF dimension ID.
*
* @returns NC_NOERR No error.
* @returns NC_EHDFERR HDF5 returned an error.
* @author Ed Hartnett
*/
static int
write_netcdf4_dimid(hid_t datasetid, int dimid)
{
@ -1595,7 +1634,16 @@ write_netcdf4_dimid(hid_t datasetid, int dimid)
return NC_NOERR;
}
/* This function creates the HDF5 dataset for a variable. */
/**
* @internal This function creates the HDF5 dataset for a variable.
*
* @param grp Pointer to group info struct.
* @param var Pointer to variable info struct.
* @param write_dimid True to write dimid.
*
* @return ::NC_NOERR
* @author Ed Hartnett
*/
static int
var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, nc_bool_t write_dimid)
{
@ -1855,7 +1903,16 @@ exit:
return retval;
}
/* Adjust the chunk cache of a var for better performance. */
/**
* @internal Adjust the chunk cache of a var for better
* performance.
*
* @param grp Pointer to group info struct.
* @param var Pointer to var info struct.
*
* @return NC_NOERR No error.
* @author Ed Hartnett
*/
int
nc4_adjust_var_cache(NC_GRP_INFO_T *grp, NC_VAR_INFO_T * var)
{
@ -1894,8 +1951,16 @@ nc4_adjust_var_cache(NC_GRP_INFO_T *grp, NC_VAR_INFO_T * var)
return NC_NOERR;
}
/* Create a HDF5 defined type from a NC_TYPE_INFO_T struct, and commit
* it to the file. */
/**
* @internal Create a HDF5 defined type from a NC_TYPE_INFO_T struct,
* and commit it to the file.
*
* @param grp Pointer to group info struct.
* @param type Pointer to type info struct.
*
* @return NC_NOERR No error.
* @author Ed Hartnett
*/
static int
commit_type(NC_GRP_INFO_T *grp, NC_TYPE_INFO_T *type)
{
@ -2014,8 +2079,16 @@ commit_type(NC_GRP_INFO_T *grp, NC_TYPE_INFO_T *type)
return NC_NOERR;
}
/* Write an attribute, with value 1, to indicate that strict NC3 rules
* apply to this file. */
/**
* @internal Write an attribute, with value 1, to indicate that strict
* NC3 rules apply to this file.
*
* @param hdf_grpid HDF5 group ID.
*
* @returns NC_NOERR No error.
* @returns NC_EHDFERR HDF5 returned an error.
* @author Ed Hartnett
*/
static int
write_nc3_strict_att(hid_t hdf_grpid)
{
@ -2049,6 +2122,14 @@ exit:
return retval;
}
/**
* @internal Create a HDF5 group.
*
* @param grp Pointer to group info struct.
*
* @return NC_NOERR No error.
* @author Ed Hartnett
*/
static int
create_group(NC_GRP_INFO_T *grp)
{
@ -2095,10 +2176,17 @@ exit:
return retval;
}
/* After all the datasets of the file have been read, it's time to
* sort the wheat from the chaff. Which of the datasets are netCDF
* dimensions, and which are coordinate variables, and which are
* non-coordinate variables. */
/**
* @internal After all the datasets of the file have been read, it's
* time to sort the wheat from the chaff. Which of the datasets are
* netCDF dimensions, and which are coordinate variables, and which
* are non-coordinate variables.
*
* @param grp Pointer to group info struct.
*
* @return ::NC_NOERR No error.
* @author Ed Hartnett
*/
static int
attach_dimscales(NC_GRP_INFO_T *grp)
{
@ -2163,6 +2251,16 @@ exit:
return retval;
}
/**
* @internal Does a variable exist?
*
* @param grpid HDF5 group ID.
* @param name Name of variable.
* @param exists Pointer that gets 1 of the variable exists, 0 otherwise.
*
* @return ::NC_NOERR No error.
* @author Ed Hartnett
*/
static int
var_exists(hid_t grpid, char *name, nc_bool_t *exists)
{
@ -2189,10 +2287,20 @@ var_exists(hid_t grpid, char *name, nc_bool_t *exists)
return NC_NOERR;
}
/* This function writes a variable. The principle difficulty comes
* from the possibility that this is a coordinate variable, and was
* already written to the file as a dimension-only dimscale. If this
* occurs, then it must be deleted and recreated. */
/**
* @internal This function writes a variable. The principle difficulty
* comes from the possibility that this is a coordinate variable, and
* was already written to the file as a dimension-only dimscale. If
* this occurs, then it must be deleted and recreated.
*
* @param var Pointer to variable info struct.
* @param grp Pointer to group info struct.
* @param write_dimid
*
* @returns NC_NOERR No error.
* @returns NC_EHDFERR HDF5 returned an error.
* @author Ed Hartnett
*/
static int
write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid)
{
@ -2402,6 +2510,18 @@ exit:
return retval;
}
/**
* @internal Write a dimension.
*
* @param dim Pointer to dim info struct.
* @param grp Pointer to group info struct.
* @param write_dimid
*
* @returns ::NC_NOERR No error.
* @returns ::NC_EPERM Read-only file.
* @returns ::NC_EHDFERR HDF5 returned error.
* @author Ed Hartnett
*/
static int
write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid)
{
@ -2523,12 +2643,22 @@ exit:
return retval;
}
/* 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. */
/**
* @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
*/
int
nc4_rec_detect_need_to_preserve_dimids(NC_GRP_INFO_T *grp, nc_bool_t *bad_coord_orderp)
{
@ -2588,10 +2718,18 @@ nc4_rec_detect_need_to_preserve_dimids(NC_GRP_INFO_T *grp, nc_bool_t *bad_coord_
return NC_NOERR;
}
/* Recursively write all the metadata in a group. Groups and types
* have all already been written. Propagate bad cooordinate order to
* subgroups, if detected. */
/**
* @internal Recursively write all the metadata in a group. Groups and
* types have all already been written. Propagate bad cooordinate
* order to subgroups, if detected.
*
* @param grp Pointer to group info struct.
* @param bad_coord_order 1 if there is a bad coordinate order.
*
* @returns NC_NOERR No error.
* @returns NC_EHDFERR HDF5 returned an error.
* @author Ed Hartnett
*/
int
nc4_rec_write_metadata(NC_GRP_INFO_T *grp, nc_bool_t bad_coord_order)
{
@ -2663,7 +2801,15 @@ nc4_rec_write_metadata(NC_GRP_INFO_T *grp, nc_bool_t bad_coord_order)
return NC_NOERR;
}
/* Recursively write all groups and types. */
/**
* @internal Recursively write all groups and types.
*
* @param grp Pointer to group info struct.
*
* @returns NC_NOERR No error.
* @returns NC_EHDFERR HDF5 returned an error.
* @author Ed Hartnett
*/
int
nc4_rec_write_groups_types(NC_GRP_INFO_T *grp)
{
@ -3687,9 +3833,18 @@ nc4_convert_type(const void *src, void *dest,
return NC_NOERR;
}
/* In our first pass through the data, we may have encountered
* variables before encountering their dimscales, so go through the
* vars in this file and make sure we've got a dimid for each. */
/**
* @internal In our first pass through the data, we may have
* encountered variables before encountering their dimscales, so go
* through the vars in this file and make sure we've got a dimid for
* each.
*
* @param grp Pointer to group info struct.
*
* @returns NC_NOERR No error.
* @returns NC_EHDFERR HDF5 returned an error.
* @author Ed Hartnett
*/
int
nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
{
@ -3859,7 +4014,19 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
return retval;
}
/* Get the length, in bytes, of one element of a type in memory. */
/**
* @internal Get the length, in bytes, of one element of a type in
* memory.
*
* @param h5 Pointer to HDF5 file info struct.
* @param xtype NetCDF type ID.
* @param is_long True only if NC_LONG is the memory type.
* @param len Pointer that gets lenght in bytes.
*
* @returns NC_NOERR No error.
* @returns NC_EBADTYPE Type not found
* @author Ed Hartnett
*/
int
nc4_get_typelen_mem(NC_HDF5_FILE_INFO_T *h5, nc_type xtype, int is_long,
size_t *len)
@ -3918,7 +4085,18 @@ nc4_get_typelen_mem(NC_HDF5_FILE_INFO_T *h5, nc_type xtype, int is_long,
return NC_NOERR;
}
/* Get the class of a type */
/**
* @internal Get the class of a type
*
* @param h5 Pointer to the HDF5 file info struct.
* @param xtype NetCDF type ID.
* @param type_class Pointer that gets class of type, NC_INT,
* NC_FLOAT, NC_CHAR, or NC_STRING, NC_ENUM, NC_VLEN, NC_COMPOUND, or
* NC_OPAQUE.
*
* @return ::NC_NOERR No error.
* @author Ed Hartnett
*/
int
nc4_get_typeclass(const NC_HDF5_FILE_INFO_T *h5, nc_type xtype, int *type_class)
{
@ -3979,15 +4157,18 @@ exit:
return retval;
}
int
NC4_test_netcdf4(void)
{
return NC_NOERR;
}
/**
* @internal
*
* @param log
* @param id HDF5 ID.
* @param type
*
* @return NC_NOERR No error.
*/
void
reportobject(int log, hid_t id, unsigned int type)
{
# define MAXNAME 1024
char name[MAXNAME];
ssize_t len;
const char* typename = NULL;
@ -4018,8 +4199,16 @@ reportobject(int log, hid_t id, unsigned int type)
}
}
static unsigned int OTYPES[5] = {H5F_OBJ_FILE, H5F_OBJ_DATASET, H5F_OBJ_GROUP, H5F_OBJ_DATATYPE, H5F_OBJ_ATTR};
/**
* @internal
*
* @param log
* @param fid HDF5 ID.
* @param ntypes Number of types.
* @param otypes Pointer that gets number of open types.
*
* @return ::NC_NOERR No error.
*/
static void
reportopenobjectsT(int log, hid_t fid, int ntypes, unsigned int* otypes)
{
@ -4049,6 +4238,14 @@ reportopenobjectsT(int log, hid_t fid, int ntypes, unsigned int* otypes)
if(idlist != NULL) free(idlist);
}
/**
* @internal Report open objects.
*
* @param log
* @param fid HDF5 file ID.
*
* @return NC_NOERR No error.
*/
void
reportopenobjects(int log, hid_t fid)
{

View File

@ -1,8 +1,11 @@
/*********************************************************************
* Copyright 2010, UCAR/Unidata
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
* ********************************************************************/
/**
* @file
* @internal Add provenance info for netcdf-4 files.
*
* Copyright 2010, UCAR/Unidata See netcdf/COPYRIGHT file for copying
* and redistribution conditions.
* @author Dennis Heimbigner
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
@ -10,16 +13,22 @@
#include "netcdf.h"
#include "nc4internal.h"
#define IGNORE 0
#define HDF5_MAX_NAME 1024
#define HDF5_MAX_NAME 1024 /**< HDF5 max name. */
/** @internal Check NetCDF return code. */
#define NCHECK(expr) {if((expr)!=NC_NOERR) {goto done;}}
/** @internal Check HDF5 return code. */
#define HCHECK(expr) {if((expr)<0) {ncstat = NC_EHDFERR; goto done;}}
/* Global */
struct NCPROPINFO globalpropinfo;
struct NCPROPINFO globalpropinfo; /**< Global property info. */
/**
* @internal Initialize file info.
*
* @return ::NC_NOERR No error.
* @author Dennis Heimbigner
*/
int
NC4_fileinfo_init(void)
{
@ -41,6 +50,15 @@ done:
return stat;
}
/**
* @internal Parse file properties.
*
* @param ncprops Property info.
* @param text Text properties.
*
* @return ::NC_NOERR No error.
* @author Dennis Heimbigner
*/
static int
NC4_properties_parse(struct NCPROPINFO* ncprops, const char* text)
{
@ -93,6 +111,14 @@ done:
return ret;
}
/**
* @internal Get properties attribure.
*
* @param h5 Pointer to HDF5 file info struct.
*
* @return ::NC_NOERR No error.
* @author Dennis Heimbigner
*/
static int
NC4_get_propattr(NC_HDF5_FILE_INFO_T* h5)
{
@ -137,6 +163,14 @@ done:
return ncstat;
}
/**
* @internal Write the properties attribute to file.
*
* @param h5 Pointer to HDF5 file info struct.
*
* @return ::NC_NOERR No error.
* @author Dennis Heimbigner
*/
int
NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5)
{
@ -175,6 +209,15 @@ NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5)
return ncstat;
}
/**
* @internal
*
* @param h5 Pointer to HDF5 file info struct.
* @param init Initialization.
*
* @return ::NC_NOERR No error.
* @author Dennis Heimbigner
*/
int
NC4_get_fileinfo(NC_HDF5_FILE_INFO_T* h5, struct NCPROPINFO* init)
{
@ -197,6 +240,15 @@ done:
return ncstat;
}
/**
* @internal Build properties attribute.
*
* @param info Properties info.
* @param propdatap Pointer that gets properties data.
*
* @return ::NC_NOERR No error.
* @author Dennis Heimbigner
*/
int
NC4_buildpropinfo(struct NCPROPINFO* info,char** propdatap)
{

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,9 @@
#include "nc4internal.h"
#include "nc4dispatch.h"
#define NUM_ATOMIC_TYPES 13
#define NUM_ATOMIC_TYPES 13 /**< Number of netCDF atomic types. */
/** @internal Names of atomic types. */
char atomic_name[NUM_ATOMIC_TYPES][NC_MAX_NAME + 1] = {"none", "byte", "char",
"short", "int", "float",
"double", "ubyte",
@ -25,14 +27,14 @@ char atomic_name[NUM_ATOMIC_TYPES][NC_MAX_NAME + 1] = {"none", "byte", "char",
/* The sizes of types may vary from platform to platform, but within
* netCDF files, type sizes are fixed. */
#define NC_CHAR_LEN sizeof(char)
#define NC_STRING_LEN sizeof(char *)
#define NC_BYTE_LEN 1
#define NC_SHORT_LEN 2
#define NC_INT_LEN 4
#define NC_FLOAT_LEN 4
#define NC_DOUBLE_LEN 8
#define NC_INT64_LEN 8
#define NC_CHAR_LEN sizeof(char) /**< @internal Size of char. */
#define NC_STRING_LEN sizeof(char *) /**< @internal Size of char *. */
#define NC_BYTE_LEN 1 /**< @internal Size of byte. */
#define NC_SHORT_LEN 2 /**< @internal Size of short. */
#define NC_INT_LEN 4 /**< @internal Size of int. */
#define NC_FLOAT_LEN 4 /**< @internal Size of float. */
#define NC_DOUBLE_LEN 8 /**< @internal Size of double. */
#define NC_INT64_LEN 8 /**< @internal Size of int64. */
/**
* @internal Determine if two types are equal.
@ -43,7 +45,10 @@ char atomic_name[NUM_ATOMIC_TYPES][NC_MAX_NAME + 1] = {"none", "byte", "char",
* @param typeid2 Second type ID.
* @param equalp Pointer that will get 1 if the two types are equal.
*
* @return NC_NOERR No error.
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_EBADTYPE Type not found.
* @return ::NC_EINVAL Invalid type.
* @author Ed Hartnett
*/
extern int
@ -111,7 +116,11 @@ NC4_inq_type_equal(int ncid1, nc_type typeid1, int ncid2,
* @param name Name of type.
* @param typeidp Pointer that will get the type ID.
*
* @return NC_NOERR No error.
* @return ::NC_NOERR No error.
* @return ::NC_ENOMEM Out of memory.
* @return ::NC_EINVAL Bad size.
* @return ::NC_ENOTNC4 User types in netCDF-4 files only.
* @return ::NC_EBADTYPE Type not found.
* @author Ed Hartnett
*/
extern int
@ -238,6 +247,8 @@ NC4_inq_typeids(int ncid, int *ntypes, int *typeids)
* @return ::NC_EBADID Bad ncid.
* @return ::NC_ENOTNC4 User types in netCDF-4 files only.
* @return ::NC_EINVAL Bad size.
* @return ::NC_EMAXNAME Name is too long.
* @return ::NC_EBADNAME Name breaks netCDF name rules.
* @author Ed Hartnett
*/
static int
@ -374,6 +385,8 @@ NC4_inq_type(int ncid, nc_type typeid1, char *name, size_t *size)
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_EMAXNAME Name is too long.
* @return ::NC_EBADNAME Name breaks netCDF name rules.
* @author Ed Hartnett
*/
int
@ -393,6 +406,8 @@ NC4_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp)
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_EMAXNAME Name is too long.
* @return ::NC_EBADNAME Name breaks netCDF name rules.
* @author Ed Hartnett
*/
int
@ -407,9 +422,17 @@ NC4_insert_compound(int ncid, nc_type typeid1, const char *name, size_t offset,
* @internal Insert a named array into a compound type.
*
* @param ncid File and group ID.
* @param typeid1 Type ID.
* @param name Name of the array field.
* @param offset Offset in bytes.
* @param field_typeid Type of field.
* @param ndims Number of dims for field.
* @param dim_sizesp Array of dim sizes.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_EMAXNAME Name is too long.
* @return ::NC_EBADNAME Name breaks netCDF name rules.
* @author Ed Hartnett
*/
extern int
@ -629,6 +652,7 @@ find_nc4_file(int ncid, NC **nc)
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_EBADTYPE Type not found.
* @return ::NC_EBADFIELD Field not found.
* @author Ed Hartnett
*/
int
@ -685,6 +709,8 @@ NC4_inq_compound_fieldindex(int ncid, nc_type typeid1, const char *name, int *fi
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_EMAXNAME Name is too long.
* @return ::NC_EBADNAME Name breaks netCDF name rules.
* @author Ed Hartnett
*/
int
@ -705,6 +731,8 @@ NC4_def_opaque(int ncid, size_t datum_size, const char *name,
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_EMAXNAME Name is too long.
* @return ::NC_EBADNAME Name breaks netCDF name rules.
* @author Ed Hartnett
*/
int
@ -724,6 +752,8 @@ NC4_def_vlen(int ncid, const char *name, nc_type base_typeid,
* @param typeidp Pointer that gets new type ID.
*
* @return ::NC_NOERR No error.
* @return ::NC_EMAXNAME Name is too long.
* @return ::NC_EBADNAME Name breaks netCDF name rules.
* @author Ed Hartnett
*/
int
@ -834,6 +864,8 @@ NC4_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier)
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_EBADTYPE Type not found.
* @return ::NC_EINVAL Bad idx.
* @author Ed Hartnett
*/
int
@ -891,7 +923,7 @@ NC4_inq_enum_member(int ncid, nc_type typeid1, int idx, char *identifier,
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_EBADTYPE Type not found.
* @return ::NC_ETYPEDEFINED Type already defined.
* @return ::NC_ETYPDEFINED Type already defined.
* @author Ed Hartnett
*/
int

View File

@ -14,17 +14,15 @@
#include "nc4dispatch.h"
#include <math.h>
/* Min and max deflate levels tolerated by HDF5. */
#define MIN_DEFLATE_LEVEL 0
#define MAX_DEFLATE_LEVEL 9
/* One meg is the minimum buffer size. */
#define ONE_MEG 1048576
/* Szip options. */
#define NC_SZIP_EC_OPTION_MASK 4
#define NC_SZIP_NN_OPTION_MASK 32
#define NC_SZIP_MAX_PIXELS_PER_BLOCK 32
#define NC_SZIP_EC_OPTION_MASK 4 /**< @internal SZIP EC option mask. */
#define NC_SZIP_NN_OPTION_MASK 32 /**< @internal SZIP NN option mask. */
#define NC_SZIP_MAX_PIXELS_PER_BLOCK 32 /**< @internal SZIP max pixels per block. */
/** @internal Default size for unlimited dim chunksize */
#define DEFAULT_1D_UNLIM_SIZE (4096)
#define NC_ARRAY_GROWBY 4 /**< @internal Amount to grow array. */
extern int nc4_get_default_fill_value(const NC_TYPE_INFO_T *type_info,
void *fill_value);
@ -282,6 +280,9 @@ check_chunksizes(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, const size_t *chunksize
/**
* @internal Determine some default chunksizes for a variable.
*
* @param grp Pointer to the group info.
* @param var Pointer to the var info.
*
* @returns ::NC_NOERR for success
* @returns ::NC_EBADID Bad ncid.
* @returns ::NC_ENOTVAR Invalid variable ID.
@ -325,7 +326,6 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
/* Special case to avoid 1D vars with unlim dim taking huge amount
of space (DEFAULT_CHUNK_SIZE bytes). Instead we limit to about
4KB */
#define DEFAULT_1D_UNLIM_SIZE (4096) /* TODO: make build-time parameter? */
if (var->ndims == 1 && num_unlim == 1) {
if (DEFAULT_CHUNK_SIZE / type_size <= 0)
suggested_size = 1;
@ -400,16 +400,17 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
return NC_NOERR;
}
#define NC_ARRAY_GROWBY 4
/**
* @internal Grow the variable array.
*
* @param grp Pointer to the group info.
* @param var Pointer to the var info.
*
* @returns ::NC_NOERR No error.
* @returns ::NC_ENOMEM Out of memory.
* @author Dennis Heimbigner
*/
int nc4_vararray_add(NC_GRP_INFO_T *grp,
NC_VAR_INFO_T *var)
int nc4_vararray_add(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
{
NC_VAR_INFO_T **vp = NULL;
@ -1014,8 +1015,8 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *deflate,
if (deflate && deflate_level)
{
if (*deflate)
if (*deflate_level < MIN_DEFLATE_LEVEL ||
*deflate_level > MAX_DEFLATE_LEVEL)
if (*deflate_level < NC_MIN_DEFLATE_LEVEL ||
*deflate_level > NC_MAX_DEFLATE_LEVEL)
return NC_EINVAL;
/* For scalars, just ignore attempt to deflate. */

View File

@ -1989,4 +1989,3 @@ main(int argc, char**argv)
exit(EXIT_FAILURE);
exit(EXIT_SUCCESS);
}
END_OF_MAIN()

View File

@ -2357,6 +2357,3 @@ main(int argc, char *argv[])
}
exit(EXIT_SUCCESS);
}
END_OF_MAIN()

View File

@ -588,7 +588,6 @@ main(
return 0;
}
END_OF_MAIN()
void
init_netcdf(void) /* initialize global counts, flags */

View File

@ -243,4 +243,3 @@ main(
return 1;
return 0;
}
END_OF_MAIN()