NetCDF 4.8.0
Loading...
Searching...
No Matches
nc4attr.c File Reference
#include "nc.h"
#include "nc4internal.h"
#include "nc4dispatch.h"
#include "ncdispatch.h"

Go to the source code of this file.

Functions

int nc4_get_att (int ncid, int varid, const char *name, nc_type *xtype, nc_type mem_type, size_t *lenp, int *attnum, void *data)
 
int NC4_get_att (int ncid, int varid, const char *name, void *value, nc_type memtype)
 
int nc4_get_att_ptrs (NC_FILE_INFO_T *h5, NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, const char *name, nc_type *xtype, nc_type mem_type, size_t *lenp, int *attnum, void *data)
 
int NC4_inq_att (int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp)
 
int NC4_inq_attid (int ncid, int varid, const char *name, int *attnump)
 
int NC4_inq_attname (int ncid, int varid, int attnum, char *name)
 

Detailed Description

This file is part of netcdf-4, a netCDF-like interface for HDF5, or a HDF5 backend for netCDF, depending on your point of view.

This file handles the nc4 attribute functions.

Remember that with atts, type conversion can take place when writing them, and when reading them.

Author
Ed Hartnett

Definition in file nc4attr.c.

Function Documentation

◆ nc4_get_att()

int nc4_get_att ( int ncid,
int varid,
const char * name,
nc_type * xtype,
nc_type mem_type,
size_t * lenp,
int * attnum,
void * data )

Get or put attribute metadata from our linked list of file info. Always locate the attribute by name, never by attnum. The mem_type is ignored if data=NULL.

Parameters
ncidFile and group ID.
varidVariable ID.
nameName of attribute.
xtypePointer that gets (file) type of attribute. Ignored if NULL.
mem_typeThe type of attribute data in memory.
lenpPointer that gets length of attribute array. Ignored if NULL.
attnumPointer that gets the index number of this attribute. Ignored if NULL.
dataPointer that gets attribute data. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
Author
Ed Hartnett

Definition at line 213 of file nc4attr.c.

◆ NC4_get_att()

int NC4_get_att ( int ncid,
int varid,
const char * name,
void * value,
nc_type memtype )

Get an attribute.

Parameters
ncidFile and group ID.
varidVariable ID.
nameName of attribute.
valuePointer that gets attribute data.
memtypeThe type the data should be converted to as it is read.
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
Author
Ed Hartnett

Definition at line 336 of file nc4attr.c.

◆ nc4_get_att_ptrs()

int nc4_get_att_ptrs ( NC_FILE_INFO_T * h5,
NC_GRP_INFO_T * grp,
NC_VAR_INFO_T * var,
const char * name,
nc_type * xtype,
nc_type mem_type,
size_t * lenp,
int * attnum,
void * data )

Get or put attribute metadata from our linked list of file info. Always locate the attribute by name, never by attnum. The mem_type is ignored if data=NULL.

Parameters
ncidFile and group ID.
varidVariable ID.
nameName of attribute. Must already be normalized.
xtypePointer that gets (file) type of attribute. Ignored if NULL.
mem_typeThe type of attribute data in memory.
lenpPointer that gets length of attribute array. Ignored if NULL.
attnumPointer that gets the index number of this attribute. Ignored if NULL.
dataPointer that gets attribute data. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
Author
Ed Hartnett

Definition at line 46 of file nc4attr.c.

◆ NC4_inq_att()

int NC4_inq_att ( int ncid,
int varid,
const char * name,
nc_type * xtypep,
size_t * lenp )

Learn about an att. All the nc4 nc_inq_ functions just call nc4_get_att to get the metadata on an attribute.

Parameters
ncidFile and group ID.
varidVariable ID.
nameName of attribute.
xtypepPointer that gets type of attribute.
lenpPointer that gets length of attribute data array.
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
Author
Ed Hartnett

Definition at line 265 of file nc4attr.c.

◆ NC4_inq_attid()

int NC4_inq_attid ( int ncid,
int varid,
const char * name,
int * attnump )

Learn an attnum, given a name.

Parameters
ncidFile and group ID.
varidVariable ID.
nameName of attribute.
attnumpPointer that gets the attribute index number.
Returns
NC_NOERR No error.
Author
Ed Hartnett

Definition at line 284 of file nc4attr.c.

◆ NC4_inq_attname()

int NC4_inq_attname ( int ncid,
int varid,
int attnum,
char * name )

Given an attnum, find the att's name.

Parameters
ncidFile and group ID.
varidVariable ID.
attnumThe index number of the attribute.
namePointer that gets name of attribute.
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
Author
Ed Hartnett

Definition at line 303 of file nc4attr.c.