NetCDF  4.9.2
User-Defined Types

User defined types allow for more complex data structures. More...

Functions

int nc_inq_type_equal (int ncid1, nc_type typeid1, int ncid2, nc_type typeid2, int *equal)
 Learn if two types are equal. More...
 

Learning about User-Defined Types

Functions to learn about any kind of user-defined type.

int nc_inq_typeid (int ncid, const char *name, nc_type *typeidp)
 Find a type by name. More...
 
int nc_inq_user_type (int ncid, nc_type xtype, char *name, size_t *size, nc_type *base_nc_typep, size_t *nfieldsp, int *classp)
 Learn about a user defined type. More...
 

Compound Types

Functions to create and learn about compound types.

int nc_def_compound (int ncid, size_t size, const char *name, nc_type *typeidp)
 Create a compound type. More...
 
int nc_insert_compound (int ncid, nc_type xtype, const char *name, size_t offset, nc_type field_typeid)
 Insert a named field into a compound type. More...
 
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)
 Insert a named array field into a compound type. More...
 
int nc_inq_compound (int ncid, nc_type xtype, char *name, size_t *sizep, size_t *nfieldsp)
 Learn about a compound type. More...
 
int nc_inq_compound_name (int ncid, nc_type xtype, char *name)
 Learn the name of a compound type. More...
 
int nc_inq_compound_size (int ncid, nc_type xtype, size_t *sizep)
 Learn the size of a compound type. More...
 
int nc_inq_compound_nfields (int ncid, nc_type xtype, size_t *nfieldsp)
 Learn the number of fields in a compound type. More...
 
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)
 Get information about one of the fields of a compound type. More...
 
int nc_inq_compound_fieldname (int ncid, nc_type xtype, int fieldid, char *name)
 Get information about one of the fields of a compound type. More...
 
int nc_inq_compound_fieldoffset (int ncid, nc_type xtype, int fieldid, size_t *offsetp)
 Get information about one of the fields of a compound type. More...
 
int nc_inq_compound_fieldtype (int ncid, nc_type xtype, int fieldid, nc_type *field_typeidp)
 Get information about one of the fields of a compound type. More...
 
int nc_inq_compound_fieldndims (int ncid, nc_type xtype, int fieldid, int *ndimsp)
 Get information about one of the fields of a compound type. More...
 
int nc_inq_compound_fielddim_sizes (int ncid, nc_type xtype, int fieldid, int *dim_sizesp)
 Get information about one of the fields of a compound type. More...
 
int nc_inq_compound_fieldindex (int ncid, nc_type xtype, const char *name, int *fieldidp)
 Learn the Index of a Named Field in a Compound Type. More...
 

Enum Types

Functions to create and learn about enum types.

int nc_def_enum (int ncid, nc_type base_typeid, const char *name, nc_type *typeidp)
 Create an enum type. More...
 
int nc_insert_enum (int ncid, nc_type xtype, const char *name, const void *value)
 Insert a named member into a enum type. More...
 
int nc_inq_enum (int ncid, nc_type xtype, char *name, nc_type *base_nc_typep, size_t *base_sizep, size_t *num_membersp)
 Learn about a user-define enumeration type. More...
 
int nc_inq_enum_member (int ncid, nc_type xtype, int idx, char *name, void *value)
 Learn about a about a member of an enum type. More...
 
int nc_inq_enum_ident (int ncid, nc_type xtype, long long value, char *identifier)
 Get the name which is associated with an enum member value. More...
 

Variable Length Array Types

Functions to create and learn about VLEN types.

int nc_free_vlen (nc_vlen_t *vl)
 Free memory in a VLEN object. More...
 
int nc_free_vlens (size_t len, nc_vlen_t vlens[])
 Free an array of vlens given the number of elements and an array. More...
 
int nc_def_vlen (int ncid, const char *name, nc_type base_typeid, nc_type *xtypep)
 Use this function to define a variable length array type. More...
 
int nc_inq_vlen (int ncid, nc_type xtype, char *name, size_t *datum_sizep, nc_type *base_nc_typep)
 Learn about a VLEN type. More...
 

Opaque Types

Functions to create and learn about opaque types.

int nc_def_opaque (int ncid, size_t size, const char *name, nc_type *xtypep)
 Create an opaque type. More...
 
int nc_inq_opaque (int ncid, nc_type xtype, char *name, size_t *sizep)
 Learn about an opaque type. More...
 

Detailed Description

User defined types allow for more complex data structures.

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.

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 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 Attributes).

Function Documentation

◆ nc_def_compound()

int nc_def_compound ( int  ncid,
size_t  size,
const char *  name,
nc_type typeidp 
)

Create a compound type.

Provide an ncid, a name, and a total size (in bytes) of one element of the completed compound type.

After calling this function, fill out the type with repeated calls to nc_insert_compound(). Call nc_insert_compound() once for each field you wish to insert into the compound type.

Parameters
ncidNetCDF ID
sizeThe size, in bytes, of the compound type.
nameNetCDF Names of the created type.
typeidpThe type ID of the new type is copied here.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENAMEINUSE That name is in use.
NC_EMAXNAME Name exceeds max length NC_MAX_NAME.
NC_EBADNAME Name contains illegal characters.
NC_ESTRICTNC3 Attempting a netCDF-4 operation on a netCDF-3 file.
NC_ENOTNC4 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.
NC_EPERM Attempt to write to a read-only file.
NC_ENOTINDEFINE Not in define mode.

Example

struct s1
{
int i1;
int i2;
};
struct s1 data[DIM_LEN], data_in[DIM_LEN];
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_compound(ncid, sizeof(struct s1), SVC_REC, &typeid)) ERR;
if (nc_insert_compound(ncid, typeid, BATTLES_WITH_KLINGONS,
HOFFSET(struct s1, i1), NC_INT)) ERR;
if (nc_insert_compound(ncid, typeid, DATES_WITH_ALIENS,
HOFFSET(struct s1, i2), NC_INT)) ERR;
if (nc_def_dim(ncid, STARDATE, DIM_LEN, &dimid)) ERR;
if (nc_def_var(ncid, SERVICE_RECORD, typeid, 1, dimids, &varid)) ERR;
if (nc_put_var(ncid, varid, data)) ERR;
if (nc_close(ncid)) ERR;
EXTERNL int nc_close(int ncid)
Close an open netCDF dataset.
Definition: dfile.c:1302
EXTERNL int nc_create(const char *path, int cmode, int *ncidp)
Create a new netCDF file.
Definition: dfile.c:400
EXTERNL int nc_def_dim(int ncid, const char *name, size_t len, int *idp)
Define a new dimension.
Definition: ddim.c:121
EXTERNL int nc_insert_compound(int ncid, nc_type xtype, const char *name, size_t offset, nc_type field_typeid)
Insert a named field into a compound type.
Definition: dcompound.c:99
EXTERNL int nc_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp)
Create a compound type.
Definition: dcompound.c:63
EXTERNL int nc_put_var(int ncid, int varid, const void *op)
Write an entire variable with one call.
Definition: dvarput.c:920
EXTERNL int nc_def_var(int ncid, const char *name, nc_type xtype, int ndims, const int *dimidsp, int *varidp)
Define a new variable.
Definition: dvar.c:214
#define NC_NETCDF4
Use netCDF-4/HDF5 format.
Definition: netcdf.h:153
#define NC_INT
signed 4 byte integer
Definition: netcdf.h:38

Definition at line 63 of file dcompound.c.

◆ nc_def_enum()

int nc_def_enum ( int  ncid,
nc_type  base_typeid,
const char *  name,
nc_type typeidp 
)

Create an enum type.

Provide an ncid, a name, and a base integer type.

After calling this function, fill out the type with repeated calls to nc_insert_enum(). Call nc_insert_enum() once for each value you wish to make part of the enumeration.

Parameters
ncidNetCDF ID
base_typeidThe base integer type for this enum. Must be one of: NC_BYTE, NC_UBYTE, NC_SHORT, NC_USHORT, NC_INT, NC_UINT, NC_INT64, NC_UINT64.
nameNetCDF Names of new type.
typeidpA pointer to an nc_type. The typeid of the new type will be placed there.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.
NC_ENAMEINUSE That name is in use.
NC_EMAXNAME Name exceeds max length NC_MAX_NAME.
NC_EBADNAME Name contains illegal characters.
NC_EPERM Attempt to write to a read-only file.
NC_ENOTINDEFINE Not in define mode.

Definition at line 43 of file denum.c.

◆ nc_def_opaque()

int nc_def_opaque ( int  ncid,
size_t  size,
const char *  name,
nc_type xtypep 
)

Create an opaque type.

Provide a size and a name.

Parameters
ncidNetCDF ID
sizeThe size of each opaque object in bytes.
nameNetCDF Names of the new type.
xtypepPointer where the new typeid for this type is returned.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.
NC_ENAMEINUSE That name is in use.
NC_EMAXNAME Name exceeds max length NC_MAX_NAME.
NC_EBADNAME Name contains illegal characters.
NC_EPERM Attempt to write to a read-only file.
NC_ENOTINDEFINE Not in define mode.

Definition at line 33 of file dopaque.c.

◆ nc_def_vlen()

int nc_def_vlen ( int  ncid,
const char *  name,
nc_type  base_typeid,
nc_type xtypep 
)

Use this function to define a variable length array type.

Parameters
ncidNetCDF ID
nameNetCDF Names of new type.
base_typeidThe typeid of the base type of the VLEN. For example, for a VLEN of shorts, the base type is NC_SHORT. This can be a user defined type.
xtypepA pointer to an nc_type variable. The typeid of the new VLEN type will be set here.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.
NC_ENAMEINUSE That name is in use.
NC_EMAXNAME Name exceeds max length NC_MAX_NAME.
NC_EBADNAME Name contains illegal characters.
NC_EPERM Attempt to write to a read-only file.
NC_ENOTINDEFINE Not in define mode.

Definition at line 115 of file dvlen.c.

◆ nc_free_vlen()

int nc_free_vlen ( nc_vlen_t vl)

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.

WARNING: this code is incorrect because it will only work if the basetype of the vlen is

  • atomic (excluding string basetype)
  • + enum
  • + opaque

The reason is that to operate properly, it needs to recurse when the basetype is a complex object such as another vlen or compound.

This function is deprecated in favor of the function "nc_reclaim_data". See include/netcdf.h.

Parameters
vlpointer to the vlen object.
Returns
NC_NOERR No error.

Definition at line 43 of file dvlen.c.

◆ nc_free_vlens()

int nc_free_vlens ( size_t  len,
nc_vlen_t  vlens[] 
)

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.

WARNING: this code is incorrect because it will only work if the basetype of the vlen is

  • atomic
  • + enum
  • + opaque
  • excluding string basetype,

The reason is that to operate properly, it needs to recurse when the basetype is a complex object such as another vlen or compound.

This function is deprecated in favor of the function "nc_reclaim_data". See include/netcdf.h.

Parameters
lennumber of elements in the array.
vlenspointer to the vlen object.
Returns
NC_NOERR No error.

Definition at line 77 of file dvlen.c.

◆ nc_inq_compound()

int nc_inq_compound ( int  ncid,
nc_type  xtype,
char *  name,
size_t *  sizep,
size_t *  nfieldsp 
)

Learn about a compound type.

Get the number of fields, len, and name of a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
nameReturned NetCDF Names of compound type. Ignored if NULL.
sizepReturned size of compound type in bytes. Ignored if NULL.
nfieldspThe number of fields in the compound type will be placed here. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 175 of file dcompound.c.

◆ nc_inq_compound_field()

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 
)

Get information about one of the fields of a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
fieldidA zero-based index number specifying a field in the compound type.
nameReturned NetCDF Names of the field. Ignored if NULL.
offsetpA pointer which will get the offset of the field. Ignored if NULL.
field_typeidpA pointer which will get the typeid of the field. Ignored if NULL.
ndimspA pointer which will get the number of dimensions of the field. Ignored if NULL.
dim_sizespA pointer which will get the dimension sizes of the field. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 287 of file dcompound.c.

◆ nc_inq_compound_fielddim_sizes()

int nc_inq_compound_fielddim_sizes ( int  ncid,
nc_type  xtype,
int  fieldid,
int *  dim_sizesp 
)

Get information about one of the fields of a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
fieldidA zero-based index number specifying a field in the compound type.
dim_sizespA pointer which will get the dimension sizes of the field. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 443 of file dcompound.c.

◆ nc_inq_compound_fieldindex()

int nc_inq_compound_fieldindex ( int  ncid,
nc_type  xtype,
const char *  name,
int *  fieldidp 
)

Learn the Index of a Named Field in a Compound Type.

Get the index of a field in a compound type from the name.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
nameNetCDF Names of the field. Ignored if NULL.
fieldidpA pointer which will get the index of the named field. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 475 of file dcompound.c.

◆ nc_inq_compound_fieldname()

int nc_inq_compound_fieldname ( int  ncid,
nc_type  xtype,
int  fieldid,
char *  name 
)

Get information about one of the fields of a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
fieldidA zero-based index number specifying a field in the compound type.
nameReturned NetCDF Names of the field. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 321 of file dcompound.c.

◆ nc_inq_compound_fieldndims()

int nc_inq_compound_fieldndims ( int  ncid,
nc_type  xtype,
int  fieldid,
int *  ndimsp 
)

Get information about one of the fields of a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
fieldidA zero-based index number specifying a field in the compound type.
ndimspA pointer which will get the number of dimensions of the field. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 413 of file dcompound.c.

◆ nc_inq_compound_fieldoffset()

int nc_inq_compound_fieldoffset ( int  ncid,
nc_type  xtype,
int  fieldid,
size_t *  offsetp 
)

Get information about one of the fields of a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
fieldidA zero-based index number specifying a field in the compound type.
offsetpA pointer which will get the offset of the field. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 353 of file dcompound.c.

◆ nc_inq_compound_fieldtype()

int nc_inq_compound_fieldtype ( int  ncid,
nc_type  xtype,
int  fieldid,
nc_type field_typeidp 
)

Get information about one of the fields of a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
fieldidA zero-based index number specifying a field in the compound type.
field_typeidpA pointer which will get the typeid of the field. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 383 of file dcompound.c.

◆ nc_inq_compound_name()

int nc_inq_compound_name ( int  ncid,
nc_type  xtype,
char *  name 
)

Learn the name of a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
nameReturned NetCDF Names of compound type. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 203 of file dcompound.c.

◆ nc_inq_compound_nfields()

int nc_inq_compound_nfields ( int  ncid,
nc_type  xtype,
size_t *  nfieldsp 
)

Learn the number of fields in a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
nfieldspThe number of fields in the compound type will be placed here. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 249 of file dcompound.c.

◆ nc_inq_compound_size()

int nc_inq_compound_size ( int  ncid,
nc_type  xtype,
size_t *  sizep 
)

Learn the size of a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
sizepReturned size of compound type in bytes. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 226 of file dcompound.c.

◆ nc_inq_enum()

int nc_inq_enum ( int  ncid,
nc_type  xtype,
char *  name,
nc_type base_nc_typep,
size_t *  base_sizep,
size_t *  num_membersp 
)

Learn about a user-define enumeration type.

Parameters
ncidNetCDF ID
xtypeTypeid to inquire about.
nameNetCDF Names of type will be copied here. Ignored if NULL.
base_nc_typepTypeid if the base type of the enum.Ignored if NULL.
base_sizepPointer that will get the size in bytes of the base type. Ignored if NULL.
num_memberspPointer that will get the number of members defined for this enum type. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 107 of file denum.c.

◆ nc_inq_enum_ident()

int nc_inq_enum_ident ( int  ncid,
nc_type  xtype,
long long  value,
char *  identifier 
)

Get the name which is associated with an enum member value.

Parameters
ncid
xtypeTypeid of the enum type.
valueValue of interest.
identifierThe identifier (NetCDF Names) of this value will be copied here; ignored_if_null.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 164 of file denum.c.

◆ nc_inq_enum_member()

int nc_inq_enum_member ( int  ncid,
nc_type  xtype,
int  idx,
char *  name,
void *  value 
)

Learn about a about a member of an enum type.

Parameters
ncidNetCDF ID
xtypeTypeid of the enum type.
idxIndex to the member to inquire about.
nameThe identifier (NetCDF Names) of this member will be copied here. Ignored if NULL.
valueThe value of this member will be copied here. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 140 of file denum.c.

◆ nc_inq_opaque()

int nc_inq_opaque ( int  ncid,
nc_type  xtype,
char *  name,
size_t *  sizep 
)

Learn about an opaque type.

Parameters
ncidNetCDF ID
xtypeTypeid to inquire about.
nameThe NetCDF Names of this type will be copied here. Ignored if NULL.
sizepThe size of the type will be copied here. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 61 of file dopaque.c.

◆ nc_inq_type_equal()

int nc_inq_type_equal ( int  ncid1,
nc_type  typeid1,
int  ncid2,
nc_type  typeid2,
int *  equal 
)

Learn if two types are equal.

Note
User-defined types in netCDF-4/HDF5 files must be committed to the file before nc_inq_type_equal() will work on the type. For uncommitted user-defined types, nc_inq_type_equal() will return NC_EHDFERR. Commit types to the file with a call to nc_enddef().
Parameters
ncid1NetCDF ID of first typeid.
typeid1First typeid.
ncid2NetCDF ID of second typeid.
typeid2Second typeid.
equalPointer to int. A non-zero value will be copied here if the two types are equal, a zero if they are not equal.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer. This will occur if either of the types have not been committed to the file (with an nc_enddef()).
Author
Dennis Heimbigner, Ward Fisher, Ed Hartnett

Definition at line 69 of file dtype.c.

◆ nc_inq_typeid()

int nc_inq_typeid ( int  ncid,
const char *  name,
nc_type typeidp 
)

Find a type by name.

Given a group ID and a type name, find the ID of the type. If the type is not found in the group, then the parents are searched. If still not found, the entire file is searched.

Parameters
ncidNetCDF ID
nameNetCDF Names of type to search for.
typeidpTypeid of named type will be copied here, if it is found.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.
Author
Ed Hartnett, Dennis Heimbigner

Definition at line 102 of file dtype.c.

◆ nc_inq_user_type()

int nc_inq_user_type ( int  ncid,
nc_type  xtype,
char *  name,
size_t *  size,
nc_type base_nc_typep,
size_t *  nfieldsp,
int *  classp 
)

Learn about a user defined type.

Given an ncid and a typeid, get the information about a user defined type. This function will work on any user defined type, whether compound, opaque, enumeration, or variable length array.

Parameters
ncidNetCDF ID
xtypeThe typeid
nameThe NetCDF Names will be copied here. Ignored if NULL.
sizethe (in-memory) size of the type in bytes will be copied here. VLEN type size is the size of nc_vlen_t. String size is returned as the size of a character pointer. The size may be used to malloc space for the data, no matter what the type. Ignored if NULL.
base_nc_typepThe base type will be copied here for enum and VLEN types. Ignored if NULL.
nfieldspThe number of fields will be copied here for enum and compound types. Ignored if NULL.
classpReturn the class of the user defined type, NC_VLEN, NC_OPAQUE, NC_ENUM, or NC_COMPOUND. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.
Author
Ed Hartnett, Dennis Heimbigner

Definition at line 146 of file dtype.c.

◆ nc_inq_vlen()

int nc_inq_vlen ( int  ncid,
nc_type  xtype,
char *  name,
size_t *  datum_sizep,
nc_type base_nc_typep 
)

Learn about a VLEN type.

Parameters
ncidNetCDF ID
xtypeThe type of the VLEN to inquire about.
nameNetCDF Names of the type. Ignored if NULL.
datum_sizepA pointer to a size_t, this will get the size of one element of this vlen. Ignored if NULL.
base_nc_typepPointer to get the base type of the VLEN. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 143 of file dvlen.c.

◆ nc_insert_array_compound()

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 
)

Insert a named array field into a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
nameThe NetCDF Names of the new field.
offsetOffset in byte from the beginning of the compound type for this field.
field_typeidThe type of the field to be inserted.
ndimsNumber of dimensions in array.
dim_sizesArray of dimension sizes.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENAMEINUSE That name is in use.
NC_EMAXNAME Name exceeds max length NC_MAX_NAME.
NC_EBADNAME Name contains illegal characters.
NC_ESTRICTNC3 Attempting a netCDF-4 operation on a netCDF-3 file.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.
NC_EPERM Attempt to write to a read-only file.
NC_ENOTINDEFINE Not in define mode.

Definition at line 141 of file dcompound.c.

◆ nc_insert_compound()

int nc_insert_compound ( int  ncid,
nc_type  xtype,
const char *  name,
size_t  offset,
nc_type  field_typeid 
)

Insert a named field into a compound type.

Parameters
ncidNetCDF ID
xtypeThe typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
nameThe NetCDF Names of the new field.
offsetOffset in byte from the beginning of the compound type for this field.
field_typeidThe type of the field to be inserted.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENAMEINUSE That name is in use.
NC_EMAXNAME Name exceeds max length NC_MAX_NAME.
NC_EBADNAME Name contains illegal characters.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.
NC_EPERM Attempt to write to a read-only file.
NC_ENOTINDEFINE Not in define mode.

Definition at line 99 of file dcompound.c.

◆ nc_insert_enum()

int nc_insert_enum ( int  ncid,
nc_type  xtype,
const char *  name,
const void *  value 
)

Insert a named member into a enum type.

Parameters
ncidNetCDF ID
xtype
nameThe identifier (NetCDF Names) of the new member.
valueThe value that is to be associated with this member.
Returns
NC_NOERR No error.
NC_EBADID Bad NetCDF ID.
NC_EBADTYPE Bad type id.
NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
NC_EHDFERR An error was reported by the HDF5 layer.
NC_ENAMEINUSE That name is in use.
NC_EMAXNAME Name exceeds max length NC_MAX_NAME.
NC_EBADNAME Name contains illegal characters.
NC_EPERM Attempt to write to a read-only file.
NC_ENOTINDEFINE Not in define mode.

Definition at line 71 of file denum.c.