NetCDF  4.9.2
dattget.c
Go to the documentation of this file.
1 /* Copyright 2018 University Corporation for Atmospheric
2  Research/Unidata. See copyright file for more info. */
10 #include "ncdispatch.h"
11  /* Start doxygen member group. */
72 
132 int
133 nc_get_att(int ncid, int varid, const char *name, void *value)
134 {
135  NC* ncp;
136  int stat = NC_NOERR;
137  nc_type xtype;
138 
139  if ((stat = NC_check_id(ncid, &ncp)))
140  return stat;
141 
142  /* Need to get the type */
143  if ((stat = nc_inq_atttype(ncid, varid, name, &xtype)))
144  return stat;
145 
146  TRACE(nc_get_att);
147  return ncp->dispatch->get_att(ncid, varid, name, value, xtype);
148 }
149 
221 int
222 nc_get_att_text(int ncid, int varid, const char *name, char *value)
223 {
224  NC* ncp;
225  int stat = NC_check_id(ncid, &ncp);
226  if(stat != NC_NOERR) return stat;
227  TRACE(nc_get_att_text);
228  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_CHAR);
229 }
230 
254 int
255 nc_get_att_schar(int ncid, int varid, const char *name, signed char *value)
256 {
257  NC* ncp;
258  int stat = NC_check_id(ncid, &ncp);
259  if(stat != NC_NOERR) return stat;
260  TRACE(nc_get_att_schar);
261  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_BYTE);
262 }
263 
287 int
288 nc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *value)
289 {
290  NC* ncp;
291  int stat = NC_check_id(ncid, &ncp);
292  if(stat != NC_NOERR) return stat;
293  TRACE(nc_get_att_uchar);
294  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UBYTE);
295 }
296 
320 int
321 nc_get_att_short(int ncid, int varid, const char *name, short *value)
322 {
323  NC* ncp;
324  int stat = NC_check_id(ncid, &ncp);
325  if(stat != NC_NOERR) return stat;
326  TRACE(nc_get_att_short);
327  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_SHORT);
328 }
329 
353 int
354 nc_get_att_int(int ncid, int varid, const char *name, int *value)
355 {
356  NC* ncp;
357  int stat = NC_check_id(ncid, &ncp);
358  if(stat != NC_NOERR) return stat;
359  TRACE(nc_get_att_int);
360  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_INT);
361 }
362 
386 int
387 nc_get_att_long(int ncid, int varid, const char *name, long *value)
388 {
389  NC* ncp;
390  int stat = NC_check_id(ncid, &ncp);
391  if(stat != NC_NOERR) return stat;
392  TRACE(nc_get_att_long);
393  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, longtype);
394 }
395 
419 int
420 nc_get_att_float(int ncid, int varid, const char *name, float *value)
421 {
422  NC* ncp;
423  int stat = NC_check_id(ncid, &ncp);
424  if(stat != NC_NOERR) return stat;
425  TRACE(nc_get_att_float);
426  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_FLOAT);
427 }
428 
452 int
453 nc_get_att_double(int ncid, int varid, const char *name, double *value)
454 {
455  NC* ncp;
456  int stat = NC_check_id(ncid, &ncp);
457  if(stat != NC_NOERR) return stat;
458  TRACE(nc_get_att_double);
459  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_DOUBLE);
460 }
461 
485 int
486 nc_get_att_ubyte(int ncid, int varid, const char *name, unsigned char *value)
487 {
488  NC* ncp;
489  int stat = NC_check_id(ncid, &ncp);
490  if(stat != NC_NOERR) return stat;
491  TRACE(nc_get_att_ubyte);
492  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UBYTE);
493 }
494 
518 int
519 nc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *value)
520 {
521  NC* ncp;
522  int stat = NC_check_id(ncid, &ncp);
523  if(stat != NC_NOERR) return stat;
524  TRACE(nc_get_att_ushort);
525  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_USHORT);
526 }
527 
551 int
552 nc_get_att_uint(int ncid, int varid, const char *name, unsigned int *value)
553 {
554  NC* ncp;
555  int stat = NC_check_id(ncid, &ncp);
556  if(stat != NC_NOERR) return stat;
557  TRACE(nc_get_att_uint);
558  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UINT);
559 }
560 
584 int
585 nc_get_att_longlong(int ncid, int varid, const char *name, long long *value)
586 {
587  NC* ncp;
588  int stat = NC_check_id(ncid, &ncp);
589  if(stat != NC_NOERR) return stat;
590  TRACE(nc_get_att_longlong);
591  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_INT64);
592 }
593 
617 int
618 nc_get_att_ulonglong(int ncid, int varid, const char *name, unsigned long long *value)
619 {
620  NC *ncp;
621  int stat = NC_check_id(ncid, &ncp);
622  if(stat != NC_NOERR) return stat;
623  TRACE(nc_get_att_ulonglong);
624  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UINT64);
625 }
626 
710 int
711 nc_get_att_string(int ncid, int varid, const char *name, char **value)
712 {
713  NC *ncp;
714  int stat = NC_check_id(ncid, &ncp);
715  if(stat != NC_NOERR) return stat;
716  TRACE(nc_get_att_string);
717  return ncp->dispatch->get_att(ncid,varid,name,(void*)value, NC_STRING);
718 } /* End doxygen member group. */
int nc_get_att_int(int ncid, int varid, const char *name, int *value)
Get an attribute array of type int.
Definition: dattget.c:354
int nc_get_att_string(int ncid, int varid, const char *name, char **value)
Get an attribute array of type string.
Definition: dattget.c:711
int nc_get_att(int ncid, int varid, const char *name, void *value)
Get an attribute of any type.
Definition: dattget.c:133
int nc_get_att_float(int ncid, int varid, const char *name, float *value)
Get an attribute array of type float.
Definition: dattget.c:420
int nc_get_att_long(int ncid, int varid, const char *name, long *value)
Get an attribute array of type long.
Definition: dattget.c:387
int nc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *value)
Get an attribute of an signed char type.
Definition: dattget.c:288
int nc_get_att_longlong(int ncid, int varid, const char *name, long long *value)
Get an attribute array of type long long.
Definition: dattget.c:585
int nc_get_att_ubyte(int ncid, int varid, const char *name, unsigned char *value)
Get an attribute array of type unsigned char.
Definition: dattget.c:486
int nc_get_att_ulonglong(int ncid, int varid, const char *name, unsigned long long *value)
Get an attribute array of type unsigned long long.
Definition: dattget.c:618
int nc_get_att_text(int ncid, int varid, const char *name, char *value)
Get a text attribute.
Definition: dattget.c:222
int nc_get_att_short(int ncid, int varid, const char *name, short *value)
Get an attribute array of type short.
Definition: dattget.c:321
int nc_get_att_schar(int ncid, int varid, const char *name, signed char *value)
Get an attribute of an signed char type.
Definition: dattget.c:255
int nc_get_att_double(int ncid, int varid, const char *name, double *value)
Get an attribute array of type double.
Definition: dattget.c:453
EXTERNL int nc_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep)
Find the type of an attribute.
Definition: dattinq.c:358
int nc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *value)
Get an attribute array of type unsigned short.
Definition: dattget.c:519
int nc_get_att_uint(int ncid, int varid, const char *name, unsigned int *value)
Get an attribute array of type unsigned int.
Definition: dattget.c:552
#define NC_UINT
unsigned 4-byte int
Definition: netcdf.h:44
#define NC_INT
signed 4 byte integer
Definition: netcdf.h:38
#define NC_BYTE
signed 1 byte integer
Definition: netcdf.h:35
#define NC_DOUBLE
double precision floating point number
Definition: netcdf.h:41
#define NC_UBYTE
unsigned 1 byte int
Definition: netcdf.h:42
#define NC_FLOAT
single precision floating point number
Definition: netcdf.h:40
#define NC_SHORT
signed 2 byte integer
Definition: netcdf.h:37
#define NC_INT64
signed 8-byte int
Definition: netcdf.h:45
#define NC_UINT64
unsigned 8-byte int
Definition: netcdf.h:46
#define NC_NOERR
No Error.
Definition: netcdf.h:368
#define NC_USHORT
unsigned 2-byte int
Definition: netcdf.h:43
#define NC_STRING
string
Definition: netcdf.h:47
#define NC_CHAR
ISO/ASCII character.
Definition: netcdf.h:36
int nc_type
The nc_type type is just an int.
Definition: netcdf.h:25