netCDF  4.2.1.1
Functions
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)
int nc_put_vlen_element (int ncid, int typeid1, void *vlen_element, size_t len, const void *data)
int nc_get_vlen_element (int ncid, int typeid1, const void *vlen_element, size_t *len, void *data)

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-define enumeration type.
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.
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_vlen (nc_vlen_t *vl)
 Free memory in a VLEN object.
int nc_free_vlens (size_t len, nc_vlen_t vlens[])
 Free an array of vlens given the number of elements and an array.
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.

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

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.
nameName 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;

Definition at line 63 of file dcompound.c.

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

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

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
nameName 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 98 of file dvlen.c.

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.

Parameters:
vlpointer to the vlen object.
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 35 of file dvlen.c.

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.

Parameters:
lennumber of elements in the array.
vlenspointer to the vlen object.
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 60 of file dvlen.c.

int nc_get_vlen_element ( int  ncid,
int  typeid1,
const void *  vlen_element,
size_t *  len,
void *  data 
)

Get a VLEN element. This function reads an element of a VLEN for the Fortran APIs.

Parameters:
ncidNetCDF ID
typeid1Typeid of the VLEN.
vlen_elementPointer to the element of the VLEN.
lenLenth of the VLEN element.
dataVLEN data.
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 184 of file dvlen.c.

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

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

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.

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().
nameName 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.

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

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.

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.

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.

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

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.

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.

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

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:
ncidNetCDF ID
xtypeTypeid of the enum type.
valueValue of interest.
identifierThe identifier (Name) 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 168 of file denum.c.

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 (Name) 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.

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

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

Learn if two types are equal

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.

Definition at line 27 of file dtype.c.

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

Definition at line 59 of file dtype.c.

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

Definition at line 102 of file dtype.c.

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.
nameName 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 126 of file dvlen.c.

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

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

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 (Name) 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.

int nc_put_vlen_element ( int  ncid,
int  typeid1,
void *  vlen_element,
size_t  len,
const void *  data 
)

Put a VLEN element. This function writes an element of a VLEN for the Fortran APIs.

Parameters:
ncidNetCDF ID
typeid1Typeid of the VLEN.
vlen_elementPointer to the element of the VLEN.
lenLenth of the VLEN element.
dataVLEN data.
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_EPERM Attempt to write to a read-only file.

Definition at line 156 of file dvlen.c.

 All Data Structures Files Functions Variables Typedefs Defines

Generated on Fri Sep 14 2012 07:36:42 for netCDF. NetCDF is a Unidata library.