20#include "nc4internal.h"
21#include "nc4dispatch.h"
22#include "ncdispatch.h"
48 size_t *lenp,
int *attnum,
void *data)
50 NC_ATT_INFO_T *att = NULL;
52 int need_to_convert = 0;
60 LOG((3,
"%s: mem_type %d", __func__, mem_type));
78 mem_type = att->nc_typeid;
93 *xtype = att->nc_typeid;
95 *attnum = att->hdr.id;
109 if (data && att->len && mem_type != att->nc_typeid &&
114 if (!(bufr = malloc((
size_t)(att->len * type_size))))
118 mem_type, (
size_t)att->len, &range_error,
144 nc_hvl_t *vldest = data;
145 NC_TYPE_INFO_T *type;
155 for (i = 0; i < att->len; i++)
157 vldest[i].len = att->vldata[i].len;
158 if (!(vldest[i].p = malloc(vldest[i].len * base_typelen)))
160 memcpy(vldest[i].p, att->vldata[i].p, vldest[i].len * base_typelen);
163 else if (att->stdata)
165 for (i = 0; i < att->len; i++)
170 if (!(((
char **)data)[i] = strdup(att->stdata[i])))
174 ((
char **)data)[i] = att->stdata[i];
179 memcpy(data, bufr, (
size_t)(att->len * type_size));
214 nc_type mem_type,
size_t *lenp,
int *attnum,
void *data)
218 NC_VAR_INFO_T *var = NULL;
222 LOG((3,
"%s: ncid 0x%x varid %d mem_type %d", __func__, ncid,
233 if (!(var = (NC_VAR_INFO_T*)ncindexith(grp->vars,varid)))
235 assert(var->hdr.id == varid);
268 LOG((2,
"%s: ncid 0x%x varid %d name %s", __func__, ncid, varid, name));
286 LOG((2,
"%s: ncid 0x%x varid %d name %s", __func__, ncid, varid, name));
308 LOG((2,
"nc_inq_attname: ncid 0x%x varid %d attnum %d", ncid, varid,
317 strcpy(name, att->hdr.name);
338 return nc4_get_att(ncid, varid, name, NULL, memtype, NULL, NULL, value);
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)
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_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_get_att(int ncid, int varid, const char *name, void *value, nc_type memtype)
int nc4_find_grp_att(NC_GRP_INFO_T *grp, int varid, const char *name, int attnum, NC_ATT_INFO_T **att)
int nc4_find_grp_h5(int ncid, NC_GRP_INFO_T **grp, NC_FILE_INFO_T **h5)
int nc4_find_nc_att(int ncid, int varid, const char *name, int attnum, NC_ATT_INFO_T **att)
int nc4_normalize_name(const char *name, char *norm_name)
int nc4_find_type(const NC_FILE_INFO_T *h5, nc_type typeid, NC_TYPE_INFO_T **type)
int nc4_convert_type(const void *src, void *dest, const nc_type src_type, const nc_type dest_type, const size_t len, int *range_error, const void *fill_value, int strict_nc3)
int nc4_get_typelen_mem(NC_FILE_INFO_T *h5, nc_type xtype, size_t *len)
#define NC_ECHAR
Attempt to convert between text & numbers.
#define NC_BYTE
signed 1 byte integer
#define NC_NAT
Not A Type.
#define NC_UBYTE
unsigned 1 byte int
#define NC_ENOMEM
Memory allocation (malloc) failure.
#define NC_GLOBAL
Attribute id to put/get a global attribute.
#define NC_ENOTVAR
Variable not found.
#define NC_CLASSIC_MODEL
Enforce classic model on netCDF-4.
#define NC_MAX_NAME
Maximum for classic library.
#define NC_NOERR
No Error.
#define NC_EBADNAME
Attribute or variable name contains illegal characters.
#define NC_CHAR
ISO/ASCII character.
#define NC_ERANGE
Math result not representable.
int nc_type
The nc_type type is just an int.