Loading...
Searching...
No Matches
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.

## 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.
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.

## 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.
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.
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.
int | nc_inq_compound (int ncid, nc_type xtype, char *name, size_t *sizep, size_t *nfieldsp)
| Learn about a compound type.
int | nc_inq_compound_name (int ncid, nc_type xtype, char *name)
| Learn the name of a compound type.
int | nc_inq_compound_size (int ncid, nc_type xtype, size_t *sizep)
| Learn the size of a compound type.
int | nc_inq_compound_nfields (int ncid, nc_type xtype, size_t *nfieldsp)
| Learn the number of fields in a compound type.
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.
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.
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.
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.
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.
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.
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.

## 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.
int | nc_insert_enum (int ncid, nc_type xtype, const char *name, const void *value)
| Insert a named member into a enum type.
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-defined enumeration type.
int | nc_inq_enum_member (int ncid, nc_type xtype, int idx, char *name, void *value)
| Learn about a member of an enum type.
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.

## Variable Length Array Types

Functions to create and learn about VLEN types.
int | nc_free_vlens (size_t nelems, nc_vlen_t vlens[])
| Free an array of vlens given the number of elements and an array.
int | nc_free_vlen (nc_vlen_t *vl)
| Free memory in a single VLEN object.
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.
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.

## 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.
int | nc_inq_opaque (int ncid, nc_type xtype, char *name, size_t *sizep)
| Learn about an opaque type.

## 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.

- 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 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

  ncid | NetCDF ID
  size | The size, in bytes, of the compound type.
  name | NetCDF Names of the created type.
  typeidp | The 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;
nc_close
EXTERNL int nc_close(int ncid)
Close an open netCDF dataset.
Definition dfile.c:1330
nc_create
EXTERNL int nc_create(const char *path, int cmode, int *ncidp)
Create a new netCDF file.
Definition dfile.c:428
nc_def_dim
EXTERNL int nc_def_dim(int ncid, const char *name, size_t len, int *idp)
Define a new dimension.
Definition ddim.c:121
nc_insert_compound
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
nc_def_compound
EXTERNL int nc_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp)
Create a compound type.
Definition dcompound.c:63
nc_put_var
EXTERNL int nc_put_var(int ncid, int varid, const void *op)
Write an entire variable with one call.
Definition dvarput.c:922
nc_def_var
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:216
NC_NETCDF4
#define NC_NETCDF4
Use netCDF-4/HDF5 format.
Definition netcdf.h:179
NC_INT
#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

  ncid | NetCDF ID
  base_typeid | The 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.
  name | NetCDF Names of new type.
  typeidp | A 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 a 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

  ncid | NetCDF ID
  size | The size of each opaque object in bytes.
  name | NetCDF Names of the new type.
  xtypep | Pointer 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 a 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

  ncid | NetCDF ID
  name | NetCDF Names of new type.
  base_typeid | The 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.
  xtypep | A 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 a 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 92 of file dvlen.c.

## nc_free_vlen()

int nc_free_vlen | ( | nc_vlen_t * | vl | ) |

Free memory in a single VLEN object.

This function is equivalent to calling nc_free_vlens with nelems == 1.

Parameters

  vl | pointer to the vlen object.

Returns
  NC_NOERR No error.

Definition at line 60 of file dvlen.c.

## nc_free_vlens()

int nc_free_vlens | ( | size_t | nelems,
|  | nc_vlen_t | vlens[] )

Free an array of vlens given the number of elements and an array.

When you read an array of VLEN typed instances, the library will allocate the storage space for the data in each VLEN in the array (but not the array itself). That VLEN data must be freed eventually, so pass the pointer to the array plus the number of elements in the array to this function when you're done with the data, and it will free the all the VLEN instances. The caller is still responsible for free'ing the array itself, if it was dynamically allocated.

Warning
  This function only works if the basetype of the VLEN type is fixed size. This means it is an atomic type except NC_STRING, or an NC_ENUM, or an NC_OPAQUE, or an NC_COMPOUND where all the fields of the compound type are themselves fixed size. If you have a more complex VLEN base-type, use nc_reclaim_data() instead.

Parameters

  nelems | number of elements in the array.
  vlens | pointer to the vlen object.

Returns
  NC_NOERR No error.

Definition at line 39 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  name | Returned NetCDF Names of compound type. Ignored if NULL.
  sizep | Returned size of compound type in bytes. Ignored if NULL.
  nfieldsp | The 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 a 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  fieldid | A zero-based index number specifying a field in the compound type.
  name | Returned NetCDF Names of the field. Ignored if NULL.
  offsetp | A pointer which will get the offset of the field. Ignored if NULL.
  field_typeidp | A pointer which will get the typeid of the field. Ignored if NULL.
  ndimsp | A pointer which will get the number of dimensions of the field. Ignored if NULL.
  dim_sizesp | A 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 a 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  fieldid | A zero-based index number specifying a field in the compound type.
  dim_sizesp | A 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 a 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  name | NetCDF Names of the field. Ignored if NULL.
  fieldidp | A 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 a 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  fieldid | A zero-based index number specifying a field in the compound type.
  name | Returned 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 a 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  fieldid | A zero-based index number specifying a field in the compound type.
  ndimsp | A 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 a 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  fieldid | A zero-based index number specifying a field in the compound type.
  offsetp | A 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 a 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  fieldid | A zero-based index number specifying a field in the compound type.
  field_typeidp | A 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 a 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  name | Returned 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 a 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  nfieldsp | The 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 a 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  sizep | Returned 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 a 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-defined enumeration type.

Parameters

  ncid | NetCDF ID
  xtype | Typeid to inquire about.
  name | NetCDF Names of type will be copied here. Ignored if NULL.
  base_nc_typep | Typeid if the base type of the enum.Ignored if NULL.
  base_sizep | Pointer that will get the size in bytes of the base type. Ignored if NULL.
  num_membersp | Pointer 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 a 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 | NetCDF ID
  xtype | Typeid of the enum type.
  value | Value of interest.
  identifier | The 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 a 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 member of an enum type.

Parameters

  ncid | NetCDF ID
  xtype | Typeid of the enum type.
  idx | Index to the member to inquire about.
  name | The identifier (NetCDF Names) of this member will be copied here. Ignored if NULL.
  value | The 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 a 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

  ncid | NetCDF ID
  xtype | Typeid to inquire about.
  name | The NetCDF Names of this type will be copied here. Ignored if NULL.
  sizep | The 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 a 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

  ncid1 | NetCDF ID of first typeid.
  typeid1 | First typeid.
  ncid2 | NetCDF ID of second typeid.
  typeid2 | Second typeid.
  equal | Pointer 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 a 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

  ncid | NetCDF ID
  name | NetCDF Names of type to search for.
  typeidp | Typeid 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 a 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

  ncid | NetCDF ID
  xtype | The typeid
  name | The NetCDF Names will be copied here. Ignored if NULL.
  size | the (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_typep | The base type will be copied here for enum and VLEN types. Ignored if NULL.
  nfieldsp | The number of fields will be copied here for enum and compound types. Ignored if NULL.
  classp | Return 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 a 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

  ncid | NetCDF ID
  xtype | The type of the VLEN to inquire about.
  name | NetCDF Names of the type. Ignored if NULL.
  datum_sizep | A pointer to a size_t, this will get the size of one element of this vlen. Ignored if NULL.
  base_nc_typep | Pointer 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 a netCDF-4 file, or classic model enabled.
  NC_EHDFERR An error was reported by the HDF5 layer.

Definition at line 120 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  name | The NetCDF Names of the new field.
  offset | Offset in byte from the beginning of the compound type for this field.
  field_typeid | The type of the field to be inserted.
  ndims | Number of dimensions in array.
  dim_sizes | Array 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 a 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

  ncid | NetCDF ID
  xtype | The typeid for this compound type, as returned by nc_def_compound(), or nc_inq_var().
  name | The NetCDF Names of the new field.
  offset | Offset in byte from the beginning of the compound type for this field.
  field_typeid | The 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 a 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

  ncid | NetCDF ID
  xtype | Typeid of the enum type.
  name | The identifier (NetCDF Names) of the new member.
  value | The 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 a 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.