NetCDF  4.8.1
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. */
35 
95 int
96 nc_get_att(int ncid, int varid, const char *name, void *value)
97 {
98  NC* ncp;
99  int stat = NC_NOERR;
100  nc_type xtype;
101 
102  if ((stat = NC_check_id(ncid, &ncp)))
103  return stat;
104 
105  /* Need to get the type */
106  if ((stat = nc_inq_atttype(ncid, varid, name, &xtype)))
107  return stat;
108 
109  TRACE(nc_get_att);
110  return ncp->dispatch->get_att(ncid, varid, name, value, xtype);
111 }
112 
184 int
185 nc_get_att_text(int ncid, int varid, const char *name, char *value)
186 {
187  NC* ncp;
188  int stat = NC_check_id(ncid, &ncp);
189  if(stat != NC_NOERR) return stat;
190  TRACE(nc_get_att_text);
191  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_CHAR);
192 }
193 
217 int
218 nc_get_att_schar(int ncid, int varid, const char *name, signed char *value)
219 {
220  NC* ncp;
221  int stat = NC_check_id(ncid, &ncp);
222  if(stat != NC_NOERR) return stat;
223  TRACE(nc_get_att_schar);
224  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_BYTE);
225 }
226 
317 int
318 nc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *value)
319 {
320  NC* ncp;
321  int stat = NC_check_id(ncid, &ncp);
322  if(stat != NC_NOERR) return stat;
323  TRACE(nc_get_att_uchar);
324  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UBYTE);
325 }
326 
350 int
351 nc_get_att_short(int ncid, int varid, const char *name, short *value)
352 {
353  NC* ncp;
354  int stat = NC_check_id(ncid, &ncp);
355  if(stat != NC_NOERR) return stat;
356  TRACE(nc_get_att_short);
357  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_SHORT);
358 }
359 
383 int
384 nc_get_att_int(int ncid, int varid, const char *name, int *value)
385 {
386  NC* ncp;
387  int stat = NC_check_id(ncid, &ncp);
388  if(stat != NC_NOERR) return stat;
389  TRACE(nc_get_att_int);
390  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_INT);
391 }
392 
416 int
417 nc_get_att_long(int ncid, int varid, const char *name, long *value)
418 {
419  NC* ncp;
420  int stat = NC_check_id(ncid, &ncp);
421  if(stat != NC_NOERR) return stat;
422  TRACE(nc_get_att_long);
423  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, longtype);
424 }
425 
449 int
450 nc_get_att_float(int ncid, int varid, const char *name, float *value)
451 {
452  NC* ncp;
453  int stat = NC_check_id(ncid, &ncp);
454  if(stat != NC_NOERR) return stat;
455  TRACE(nc_get_att_float);
456  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_FLOAT);
457 }
458 
482 int
483 nc_get_att_double(int ncid, int varid, const char *name, double *value)
484 {
485  NC* ncp;
486  int stat = NC_check_id(ncid, &ncp);
487  if(stat != NC_NOERR) return stat;
488  TRACE(nc_get_att_double);
489  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_DOUBLE);
490 }
491 
515 int
516 nc_get_att_ubyte(int ncid, int varid, const char *name, unsigned char *value)
517 {
518  NC* ncp;
519  int stat = NC_check_id(ncid, &ncp);
520  if(stat != NC_NOERR) return stat;
521  TRACE(nc_get_att_ubyte);
522  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UBYTE);
523 }
524 
548 int
549 nc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *value)
550 {
551  NC* ncp;
552  int stat = NC_check_id(ncid, &ncp);
553  if(stat != NC_NOERR) return stat;
554  TRACE(nc_get_att_ushort);
555  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_USHORT);
556 }
557 
581 int
582 nc_get_att_uint(int ncid, int varid, const char *name, unsigned int *value)
583 {
584  NC* ncp;
585  int stat = NC_check_id(ncid, &ncp);
586  if(stat != NC_NOERR) return stat;
587  TRACE(nc_get_att_uint);
588  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UINT);
589 }
590 
614 int
615 nc_get_att_longlong(int ncid, int varid, const char *name, long long *value)
616 {
617  NC* ncp;
618  int stat = NC_check_id(ncid, &ncp);
619  if(stat != NC_NOERR) return stat;
620  TRACE(nc_get_att_longlong);
621  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_INT64);
622 }
623 
647 int
648 nc_get_att_ulonglong(int ncid, int varid, const char *name, unsigned long long *value)
649 {
650  NC *ncp;
651  int stat = NC_check_id(ncid, &ncp);
652  if(stat != NC_NOERR) return stat;
653  TRACE(nc_get_att_ulonglong);
654  return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UINT64);
655 }
656 
740 int
741 nc_get_att_string(int ncid, int varid, const char *name, char **value)
742 {
743  NC *ncp;
744  int stat = NC_check_id(ncid, &ncp);
745  if(stat != NC_NOERR) return stat;
746  TRACE(nc_get_att_string);
747  return ncp->dispatch->get_att(ncid,varid,name,(void*)value, NC_STRING);
748 } /* End doxygen member group. */
NC_USHORT
#define NC_USHORT
unsigned 2-byte int
Definition: netcdf.h:43
NC_NOERR
#define NC_NOERR
No Error.
Definition: netcdf.h:333
nc_get_att_ubyte
int nc_get_att_ubyte(int ncid, int varid, const char *name, unsigned char *value)
Definition: dattget.c:516
nc_get_att_ulonglong
int nc_get_att_ulonglong(int ncid, int varid, const char *name, unsigned long long *value)
Definition: dattget.c:648
NC_FLOAT
#define NC_FLOAT
single precision floating point number
Definition: netcdf.h:40
NC_DOUBLE
#define NC_DOUBLE
double precision floating point number
Definition: netcdf.h:41
nc_get_att_string
int nc_get_att_string(int ncid, int varid, const char *name, char **value)
Definition: dattget.c:741
nc_inq_atttype
EXTERNL int nc_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep)
Definition: dattinq.c:357
NC_BYTE
#define NC_BYTE
signed 1 byte integer
Definition: netcdf.h:35
nc_get_att_float
int nc_get_att_float(int ncid, int varid, const char *name, float *value)
Definition: dattget.c:450
NC_INT
#define NC_INT
signed 4 byte integer
Definition: netcdf.h:38
NC_UBYTE
#define NC_UBYTE
unsigned 1 byte int
Definition: netcdf.h:42
nc_get_att_uchar
int nc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *value)
Definition: dattget.c:318
nc_get_att_long
int nc_get_att_long(int ncid, int varid, const char *name, long *value)
Definition: dattget.c:417
nc_get_att_short
int nc_get_att_short(int ncid, int varid, const char *name, short *value)
Definition: dattget.c:351
NC_SHORT
#define NC_SHORT
signed 2 byte integer
Definition: netcdf.h:37
nc_get_att_text
int nc_get_att_text(int ncid, int varid, const char *name, char *value)
Definition: dattget.c:185
nc_get_att_schar
int nc_get_att_schar(int ncid, int varid, const char *name, signed char *value)
Definition: dattget.c:218
nc_get_att_uint
int nc_get_att_uint(int ncid, int varid, const char *name, unsigned int *value)
Definition: dattget.c:582
nc_type
int nc_type
The nc_type type is just an int.
Definition: netcdf.h:25
nc_get_att_ushort
int nc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *value)
Definition: dattget.c:549
NC_UINT64
#define NC_UINT64
unsigned 8-byte int
Definition: netcdf.h:46
nc_get_att_longlong
int nc_get_att_longlong(int ncid, int varid, const char *name, long long *value)
Definition: dattget.c:615
NC_UINT
#define NC_UINT
unsigned 4-byte int
Definition: netcdf.h:44
NC_STRING
#define NC_STRING
string
Definition: netcdf.h:47
nc_get_att_int
int nc_get_att_int(int ncid, int varid, const char *name, int *value)
Definition: dattget.c:384
NC_CHAR
#define NC_CHAR
ISO/ASCII character.
Definition: netcdf.h:36
nc_get_att_double
int nc_get_att_double(int ncid, int varid, const char *name, double *value)
Definition: dattget.c:483
nc_get_att
int nc_get_att(int ncid, int varid, const char *name, void *value)
Definition: dattget.c:96
NC_INT64
#define NC_INT64
signed 8-byte int
Definition: netcdf.h:45