mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
changed file names to allow visual studio to cope
This commit is contained in:
parent
0bbe605ca2
commit
fd4a63c4d2
14
Doxyfile
14
Doxyfile
@ -574,15 +574,11 @@ examples/C/sfc_pres_temp_wr.c examples/C/sfc_pres_temp_rd.c \
|
||||
examples/C/pres_temp_4D_wr.c examples/C/pres_temp_4D_rd.c \
|
||||
examples/C/simple_nc4_wr.c examples/C/simple_nc4_rd.c \
|
||||
examples/C/simple_xy_nc4_wr.c examples/C/simple_xy_nc4_rd.c \
|
||||
libdispatch/file.c libdispatch/dim.c \
|
||||
libdispatch/attget.c \
|
||||
libdispatch/attinq.c libdispatch/attput.c \
|
||||
libdispatch/att.c \
|
||||
libdispatch/var.c \
|
||||
libdispatch/varinq.c \
|
||||
libdispatch/varput.c libdispatch/varget.c \
|
||||
libdispatch/error.c \
|
||||
libdispatch/nc4.c \
|
||||
libdispatch/dfile.c libdispatch/ddim.c \
|
||||
libdispatch/dattget.c libdispatch/dattinq.c libdispatch/dattput.c \
|
||||
libdispatch/datt.c libdispatch/dvar.c libdispatch/dvarinq.c \
|
||||
libdispatch/dvarput.c libdispatch/dvarget.c libdispatch/derror.c \
|
||||
libdispatch/nc4.c libdispatch/dtype.c libdispatch/dv2i.c \
|
||||
libsrc4/nc4file.c \
|
||||
man4/mainpage.doc man4/tutorial.doc COPYRIGHT man4/install.doc man4/dispatch.doc \
|
||||
man4/guide.doc man4/types.doc man4/notes.doc
|
||||
|
@ -15,13 +15,14 @@ noinst_LTLIBRARIES = libdispatch.la
|
||||
libdispatch_la_CPPFLAGS = ${AM_CPPFLAGS}
|
||||
|
||||
# The source files.
|
||||
libdispatch_la_SOURCES = parallel.c copy.c file.c dim.c att.c attinq.c \
|
||||
attput.c attget.c error.c var.c varget.c varput.c varinq.c dispatch.c \
|
||||
nc_uri.c nclist.c ncbytes.c nchashmap.c nclog.c nclog.h string.c
|
||||
libdispatch_la_SOURCES = dparallel.c dcopy.c dfile.c ddim.c datt.c \
|
||||
dattinq.c dattput.c dattget.c derror.c dvar.c dvarget.c dvarput.c \
|
||||
dvarinq.c ddispatch.c nc_uri.c dnclist.c dncbytes.c dnchashmap.c \
|
||||
dnclog.c nclog.h dstring.c
|
||||
|
||||
# Add functions only found in netCDF-4.
|
||||
if USE_NETCDF4
|
||||
libdispatch_la_SOURCES += nc4.c
|
||||
libdispatch_la_SOURCES += nc4.c dtype.c
|
||||
endif # USE_NETCDF4
|
||||
|
||||
# Turn on pre-processor flag when building a DLL for windows.
|
||||
@ -32,7 +33,7 @@ endif # BUILD_DLL
|
||||
# Add V2 API convenience library if needed.
|
||||
if BUILD_V2
|
||||
noinst_LTLIBRARIES += libnetcdf2.la
|
||||
libnetcdf2_la_SOURCES = v2i.c
|
||||
libnetcdf2_la_SOURCES = dv2i.c
|
||||
libnetcdf2_la_CPPFLAGS = ${AM_CPPFLAGS} -DDLL_EXPORT
|
||||
endif # BUILD_V2
|
||||
|
||||
|
@ -508,4 +508,72 @@ nc_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp,
|
||||
return ncp->dispatch->get_var_chunk_cache(ncid, varid, sizep,
|
||||
nelemsp, preemptionp);
|
||||
}
|
||||
|
||||
/** \ingroup variables
|
||||
Free string space allocated by the library.
|
||||
|
||||
When you read string type the library will allocate the storage space
|
||||
for the data. This storage space must be freed, so pass the pointer
|
||||
back to this function, when you're done with the data, and it will
|
||||
free the string memory.
|
||||
|
||||
\param len The number of character arrays in the array.
|
||||
\param data The pointer to the data array.
|
||||
|
||||
\returns ::NC_NOERR No error.
|
||||
*/
|
||||
int
|
||||
nc_free_string(size_t len, char **data)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < len; i++)
|
||||
free(data[i]);
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int deflate_level)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_deflate(ncid,varid,shuffle,deflate,deflate_level);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_fletcher32(ncid,varid,fletcher32);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_chunking(ncid,varid,storage,chunksizesp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_fill(ncid,varid,no_fill,fill_value);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_endian(int ncid, int varid, int endian)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_endian(ncid,varid,endian);
|
||||
}
|
||||
|
||||
#endif /* USE_NETCDF4 */
|
@ -65,8 +65,7 @@ nc_create().
|
||||
|
||||
\param varid Variable ID
|
||||
|
||||
\param name Returned variable name. The caller must allocate space for
|
||||
the returned name. The maximum length is ::NC_MAX_NAME. \ref
|
||||
\param name Returned \ref object_name of variable. \ref
|
||||
ignored_if_null.
|
||||
|
||||
\param xtypep Pointer where typeid will be stored. \ref ignored_if_null.
|
||||
@ -516,5 +515,46 @@ nc_inq_var_endian(int ncid, int varid, int *endianp)
|
||||
NULL /*pixelsp*/
|
||||
);
|
||||
}
|
||||
|
||||
/** Return number and list of unlimited dimensions.
|
||||
|
||||
In netCDF-4 files, it's possible to have multiple unlimited
|
||||
dimensions. This function returns a list of the unlimited dimension
|
||||
ids visible in a group.
|
||||
|
||||
Dimensions are visible in a group if they have been defined in that
|
||||
group, or any ancestor group.
|
||||
|
||||
ncid
|
||||
NetCDF group ID, from a previous call to nc_open, nc_create, nc_def_grp, etc.
|
||||
nunlimdimsp
|
||||
A pointer to an int which will get the number of visible unlimited dimensions. Ignored if NULL.
|
||||
unlimdimidsp
|
||||
A pointer to an already allocated array of int which will get the ids of all visible unlimited dimensions. Ignored if NULL. To allocate the correct length for this array, call nc_inq_unlimdims with a NULL for this parameter and use the nunlimdimsp parameter to get the number of visible unlimited dimensions.
|
||||
|
||||
Errors
|
||||
|
||||
NC_NOERR
|
||||
No error.
|
||||
NC_EBADID
|
||||
Bad group id.
|
||||
NC_ENOTNC4
|
||||
Attempting a netCDF-4 operation on a netCDF-3 file. NetCDF-4 operations can only be performed on files defined with a create mode which includes flag HDF5. (see nc_open).
|
||||
NC_ESTRICTNC3
|
||||
This file was created with the strict netcdf-3 flag, therefore netcdf-4 operations are not allowed. (see nc_open).
|
||||
NC_EHDFERR
|
||||
An error was reported by the HDF5 layer.
|
||||
|
||||
*/
|
||||
int
|
||||
nc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_unlimdims(ncid, nunlimdimsp,
|
||||
unlimdimidsp);
|
||||
}
|
||||
|
||||
#endif /* USE_NETCDF4 */
|
||||
/*! \} */ /* End of named group ...*/
|
@ -6,41 +6,70 @@ Research/Unidata. See \ref COPYRIGHT file for more info. */
|
||||
|
||||
#include "ncdispatch.h"
|
||||
|
||||
/** \ingroup variables
|
||||
Free string space allocated by the library.
|
||||
/** \defgroup user_types User-Defined Types
|
||||
|
||||
When you read string type the library will allocate the storage space
|
||||
for the data. This storage space must be freed, so pass the pointer
|
||||
back to this function, when you're done with the data, and it will
|
||||
free the string memory.
|
||||
User defined types allow for more complex data structures.
|
||||
|
||||
\param len The number of character arrays in the array.
|
||||
\param data The pointer to the data array.
|
||||
NetCDF-4 has added support for four different user defined data
|
||||
types. User defined type may only be used in files created with the
|
||||
::NC_NETCDF4 and without ::NC_CLASSIC_MODEL.
|
||||
- compound type: like a C struct, a compound type is a collection of
|
||||
types, including other user defined types, in one package.
|
||||
- variable length array type: used to store ragged arrays.
|
||||
- opaque type: This type has only a size per element, and no other
|
||||
type information.
|
||||
- enum type: Like an enumeration in C, this type lets you assign text
|
||||
values to integer values, and store the integer values.
|
||||
|
||||
Users may construct user defined type with the various nc_def_*
|
||||
functions described in this section. They may learn about user defined
|
||||
types by using the nc_inq_ functions defined in this section.
|
||||
|
||||
Once types are constructed, define variables of the new type with
|
||||
nc_def_var (see nc_def_var). Write to them with nc_put_var1,
|
||||
nc_put_var, nc_put_vara, or nc_put_vars. Read data of user-defined
|
||||
type with nc_get_var1, nc_get_var, nc_get_vara, or nc_get_vars (see
|
||||
\ref variables).
|
||||
|
||||
Create attributes of the new type with nc_put_att (see nc_put_att_
|
||||
type). Read attributes of the new type with nc_get_att (see
|
||||
\ref attributes).
|
||||
*/
|
||||
/** \{ */
|
||||
|
||||
/** Free memory in a VLEN object.
|
||||
|
||||
When you read VLEN type the library will actually allocate the storage
|
||||
space for the data. This storage space must be freed, so pass the
|
||||
pointer back to this function, when you're done with the data, and it
|
||||
will free the vlen memory.
|
||||
|
||||
The function nc_free_vlens() is more useful than this function,
|
||||
because it can free an array of VLEN objects.
|
||||
|
||||
\param vl pointer to the vlen object.
|
||||
|
||||
\returns ::NC_NOERR No error.
|
||||
*/
|
||||
int
|
||||
nc_free_string(size_t len, char **data)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < len; i++)
|
||||
free(data[i]);
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/* When you read VLEN type the library will actually allocate the
|
||||
* storage space for the data. This storage space must be freed, so
|
||||
* pass the pointer back to this function, when you're done with the
|
||||
* data, and it will free the vlen memory. */
|
||||
int
|
||||
nc_free_vlen(nc_vlen_t *vl)
|
||||
{
|
||||
free(vl->p);
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/* Free an array of vlens given the number of elements and an
|
||||
* array. */
|
||||
/** Free an array of vlens given the number of elements and an array.
|
||||
|
||||
When you read VLEN type the library will actually allocate the storage
|
||||
space for the data. This storage space must be freed, so pass the
|
||||
pointer back to this function, when you're done with the data, and it
|
||||
will free the vlen memory.
|
||||
|
||||
\param len number of elements in the array.
|
||||
\param vlens pointer to the vlen object.
|
||||
|
||||
\returns ::NC_NOERR No error.
|
||||
*/
|
||||
int
|
||||
nc_free_vlens(size_t len, nc_vlen_t vlens[])
|
||||
{
|
||||
@ -54,101 +83,6 @@ nc_free_vlens(size_t len, nc_vlen_t vlens[])
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_ncid(int ncid, const char *name, int *grp_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_ncid(ncid,name,grp_ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grps(int ncid, int *numgrps, int *ncids)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_grps(ncid,numgrps,ncids);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grpname(int ncid, char *name)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_grpname(ncid,name);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_grpname_full(ncid,lenp,full_name);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grpname_len(int ncid, size_t *lenp)
|
||||
{
|
||||
int stat = nc_inq_grpname_full(ncid,lenp,NULL);
|
||||
return stat;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grp_parent(int ncid, int *parent_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_grp_parent(ncid,parent_ncid);
|
||||
}
|
||||
|
||||
/* This has same semantics as nc_inq_ncid */
|
||||
int
|
||||
nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid)
|
||||
{
|
||||
return nc_inq_ncid(ncid,grp_name,grp_ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_grp_full_ncid(ncid,full_name,grp_ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_varids(int ncid, int *nvars, int *varids)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_varids(ncid,nvars,varids);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_dimids(ncid,ndims,dimids,include_parents);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_typeids(int ncid, int *ntypes, int *typeids)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_typeids(ncid,ntypes,typeids);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_type_equal(int ncid1, nc_type typeid1, int ncid2,
|
||||
nc_type typeid2, int *equal)
|
||||
@ -159,42 +93,6 @@ nc_inq_type_equal(int ncid1, nc_type typeid1, int ncid2,
|
||||
return ncp1->dispatch->inq_type_equal(ncid1,typeid1,ncid2,typeid2,equal);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_grp(int parent_ncid, const char *name, int *new_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(parent_ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_grp(parent_ncid,name,new_ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_compound(ncid,size,name,typeidp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_insert_compound(int ncid, nc_type xtype, const char *name, size_t offset, nc_type field_typeid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->insert_compound(ncid,xtype,name,offset,field_typeid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_insert_array_compound(int ncid, nc_type xtype, const char *name, size_t offset, nc_type field_typeid, int ndims, const int *dim_sizes)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->insert_array_compound(ncid,xtype,name,offset,field_typeid,ndims,dim_sizes);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_typeid(int ncid, const char *name, nc_type *typeidp)
|
||||
{
|
||||
@ -204,103 +102,6 @@ nc_inq_typeid(int ncid, const char *name, nc_type *typeidp)
|
||||
return ncp->dispatch->inq_typeid(ncid,name,typeidp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound(int ncid, nc_type xtype, char *name, size_t *sizep, size_t *nfieldsp)
|
||||
{
|
||||
int class = 0;
|
||||
int stat = nc_inq_user_type(ncid,xtype,name,sizep,NULL,nfieldsp,&class);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
if(class != NC_COMPOUND) stat = NC_EBADTYPE;
|
||||
return stat;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_name(int ncid, nc_type xtype, char *name)
|
||||
{
|
||||
return nc_inq_compound(ncid,xtype,name,NULL,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_size(int ncid, nc_type xtype, size_t *sizep)
|
||||
{
|
||||
return nc_inq_compound(ncid,xtype,NULL,sizep,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_nfields(int ncid, nc_type xtype, size_t *nfieldsp)
|
||||
{
|
||||
return nc_inq_compound(ncid,xtype,NULL,NULL,nfieldsp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_field(int ncid, nc_type xtype, int fieldid, char *name, size_t *offsetp, nc_type *field_typeidp, int *ndimsp, int *dim_sizesp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,name,offsetp,field_typeidp,ndimsp,dim_sizesp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fieldname(int ncid, nc_type xtype, int fieldid,
|
||||
char *name)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,name,NULL,NULL,NULL,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fieldoffset(int ncid, nc_type xtype, int fieldid,
|
||||
size_t *offsetp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,NULL,offsetp,NULL,NULL,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fieldtype(int ncid, nc_type xtype, int fieldid,
|
||||
nc_type *field_typeidp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,NULL,NULL,field_typeidp,NULL,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fieldndims(int ncid, nc_type xtype, int fieldid,
|
||||
int *ndimsp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,NULL,NULL,NULL,ndimsp,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fielddim_sizes(int ncid, nc_type xtype, int fieldid,
|
||||
int *dim_sizes)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,NULL,NULL,NULL,NULL,dim_sizes);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fieldindex(int ncid, nc_type xtype, const char *name,
|
||||
int *fieldidp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_fieldindex(ncid,xtype,name,fieldidp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type *xtypep)
|
||||
{
|
||||
@ -411,61 +212,144 @@ nc_inq_opaque(int ncid, nc_type xtype, char *name, size_t *sizep)
|
||||
if(class != NC_OPAQUE) stat = NC_EBADTYPE;
|
||||
return stat;
|
||||
}
|
||||
/** \} */
|
||||
|
||||
/** \defgroup groups Groups
|
||||
|
||||
NetCDF-4 added support for hierarchical groups within netCDF datasets.
|
||||
|
||||
Groups are identified with a ncid, which identifies both the open
|
||||
file, and the group within that file. When a file is opened with
|
||||
nc_open or nc_create, the ncid for the root group of that file is
|
||||
provided. Using that as a starting point, users can add new groups, or
|
||||
list and navigate existing groups.
|
||||
|
||||
All netCDF calls take a ncid which determines where the call will take
|
||||
its action. For example, the nc_def_var function takes a ncid as its
|
||||
first parameter. It will create a variable in whichever group its ncid
|
||||
refers to. Use the root ncid provided by nc_create or nc_open to
|
||||
create a variable in the root group. Or use nc_def_grp to create a
|
||||
group and use its ncid to define a variable in the new group.
|
||||
|
||||
Variable are only visible in the group in which they are defined. The
|
||||
same applies to attributes. “Global” attributes are associated with
|
||||
the group whose ncid is used.
|
||||
|
||||
Dimensions are visible in their groups, and all child groups.
|
||||
|
||||
Group operations are only permitted on netCDF-4 files - that is, files
|
||||
created with the HDF5 flag in nc_create(). Groups are not compatible
|
||||
with the netCDF classic data model, so files created with the
|
||||
::NC_CLASSIC_MODEL file cannot contain groups (except the root group).
|
||||
|
||||
*/
|
||||
/** \{ */
|
||||
int
|
||||
nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int deflate_level)
|
||||
nc_inq_ncid(int ncid, const char *name, int *grp_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_deflate(ncid,varid,shuffle,deflate,deflate_level);
|
||||
return ncp->dispatch->inq_ncid(ncid,name,grp_ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
|
||||
nc_inq_grps(int ncid, int *numgrps, int *ncids)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_fletcher32(ncid,varid,fletcher32);
|
||||
return ncp->dispatch->inq_grps(ncid,numgrps,ncids);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp)
|
||||
nc_inq_grpname(int ncid, char *name)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_chunking(ncid,varid,storage,chunksizesp);
|
||||
return ncp->dispatch->inq_grpname(ncid,name);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
|
||||
nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_fill(ncid,varid,no_fill,fill_value);
|
||||
return ncp->dispatch->inq_grpname_full(ncid,lenp,full_name);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_endian(int ncid, int varid, int endian)
|
||||
nc_inq_grpname_len(int ncid, size_t *lenp)
|
||||
{
|
||||
int stat = nc_inq_grpname_full(ncid,lenp,NULL);
|
||||
return stat;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grp_parent(int ncid, int *parent_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_endian(ncid,varid,endian);
|
||||
return ncp->dispatch->inq_grp_parent(ncid,parent_ncid);
|
||||
}
|
||||
|
||||
/* This has same semantics as nc_inq_ncid */
|
||||
int
|
||||
nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid)
|
||||
{
|
||||
return nc_inq_ncid(ncid,grp_name,grp_ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_grp_full_ncid(ncid,full_name,grp_ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp)
|
||||
nc_inq_varids(int ncid, int *nvars, int *varids)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_unlimdims(ncid,nunlimdimsp,unlimdimidsp);
|
||||
return ncp->dispatch->inq_varids(ncid,nvars,varids);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_dimids(ncid,ndims,dimids,include_parents);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_typeids(int ncid, int *ntypes, int *typeids)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_typeids(ncid,ntypes,typeids);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_grp(int parent_ncid, const char *name, int *new_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(parent_ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_grp(parent_ncid,name,new_ncid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
nc_show_metadata(int ncid)
|
||||
{
|
||||
@ -475,3 +359,4 @@ nc_show_metadata(int ncid)
|
||||
return ncp->dispatch->show_metadata(ncid);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -1,7 +0,0 @@
|
||||
#include "ncdispatch.h"
|
||||
|
||||
NC_Dispatch*
|
||||
NC_getdefaultdispatch(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
@ -442,8 +442,10 @@ A zero-length name is not allowed.
|
||||
Names longer than ::NC_MAX_NAME will not be accepted any netCDF define
|
||||
function. An error of ::NC_EMAXNAME will be returned.
|
||||
|
||||
All netCDF inquiry functions will return names less than NC_MAX_NAME
|
||||
for netCDF files.
|
||||
All netCDF inquiry functions will return names of maximum size
|
||||
::NC_MAX_NAME for netCDF files. Since this does not include the
|
||||
terminating NULL, space should be reserved for NC_MAX_NAME + 1
|
||||
characters.
|
||||
|
||||
\section Conventions
|
||||
|
||||
|
@ -115,4 +115,20 @@ type-independent units of elements.
|
||||
memory locations is 1 and not the element's byte-length as in netCDF
|
||||
2.
|
||||
|
||||
\page ncid NetCDF ID
|
||||
|
||||
Most netCDF function require the netCDF ID as a first parameter.
|
||||
|
||||
In the netCDF classic model, the netCDF ID is associated with an open
|
||||
file. Each file, when opened by nc_open(), or created by nc_create(),
|
||||
is assigned an ncid, which it retains until nc_close() is called.
|
||||
|
||||
In the netCDF enhanced model, the ncid refers to a group with a
|
||||
file. (Each file contains at least the root group, which is the ncid
|
||||
that is returned by nc_open() and nc_create().)
|
||||
|
||||
For netCDF-4/HDF5 files, netCDF IDs can come not just from nc_open()
|
||||
and nc_create(), but also from nc_def_grp(), nc_inq_grps(),
|
||||
nc_inq_ncid(), nc_inq_grp_parent(), and nc_inq_grp_full_ncid().
|
||||
|
||||
*/
|
Loading…
Reference in New Issue
Block a user