NetCDF  4.9.2
dattput.c
Go to the documentation of this file.
1 /* Copyright 2018 University Corporation for Atmospheric
2  Research/Unidata. See copyright file for more info. */
9 #include "ncdispatch.h"
10  /* Start doxygen member group. */
74 int
75 nc_put_att_string(int ncid, int varid, const char *name,
76  size_t len, const char** value)
77 {
78  NC* ncp;
79  int stat = NC_check_id(ncid, &ncp);
80  if(stat != NC_NOERR) return stat;
81  return ncp->dispatch->put_att(ncid, varid, name, NC_STRING,
82  len, (void*)value, NC_STRING);
83 }
84 
153 int nc_put_att_text(int ncid, int varid, const char *name,
154  size_t len, const char *value)
155 {
156  NC* ncp;
157  int stat = NC_check_id(ncid, &ncp);
158  if(stat != NC_NOERR) return stat;
159  return ncp->dispatch->put_att(ncid, varid, name, NC_CHAR, len,
160  (void *)value, NC_CHAR);
161 }
162 
221 int
222 nc_put_att(int ncid, int varid, const char *name, nc_type xtype,
223  size_t len, const void *value)
224 {
225  NC* ncp;
226  int stat = NC_check_id(ncid, &ncp);
227  if(stat != NC_NOERR) return stat;
228  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
229  value, xtype);
230 }
231 
255 int
256 nc_put_att_schar(int ncid, int varid, const char *name,
257  nc_type xtype, size_t len, const signed char *value)
258 {
259  NC *ncp;
260  int stat = NC_check_id(ncid, &ncp);
261  if(stat != NC_NOERR) return stat;
262  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
263  (void *)value, NC_BYTE);
264 }
265 
289 int
290 nc_put_att_uchar(int ncid, int varid, const char *name,
291  nc_type xtype, size_t len, const unsigned char *value)
292 {
293  NC* ncp;
294  int stat = NC_check_id(ncid, &ncp);
295  if(stat != NC_NOERR) return stat;
296  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
297  (void *)value, NC_UBYTE);
298 }
299 
323 int
324 nc_put_att_short(int ncid, int varid, const char *name,
325  nc_type xtype, size_t len, const short *value)
326 {
327  NC* ncp;
328  int stat = NC_check_id(ncid, &ncp);
329  if(stat != NC_NOERR) return stat;
330  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
331  (void *)value, NC_SHORT);
332 }
333 
357 int
358 nc_put_att_int(int ncid, int varid, const char *name,
359  nc_type xtype, size_t len, const int *value)
360 {
361  NC* ncp;
362  int stat = NC_check_id(ncid, &ncp);
363  if(stat != NC_NOERR) return stat;
364  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
365  (void *)value, NC_INT);
366 }
367 
391 int
392 nc_put_att_long(int ncid, int varid, const char *name,
393  nc_type xtype, size_t len, const long *value)
394 {
395  NC* ncp;
396  int stat = NC_check_id(ncid, &ncp);
397  if(stat != NC_NOERR) return stat;
398  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
399  (void *)value, longtype);
400 }
401 
425 int
426 nc_put_att_float(int ncid, int varid, const char *name,
427  nc_type xtype, size_t len, const float *value)
428 {
429  NC* ncp;
430  int stat = NC_check_id(ncid, &ncp);
431  if(stat != NC_NOERR) return stat;
432  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
433  (void *)value, NC_FLOAT);
434 }
435 
459 int
460 nc_put_att_double(int ncid, int varid, const char *name,
461  nc_type xtype, size_t len, const double *value)
462 {
463  NC* ncp;
464  int stat = NC_check_id(ncid, &ncp);
465  if(stat != NC_NOERR) return stat;
466  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
467  (void *)value, NC_DOUBLE);
468 }
469 
493 int
494 nc_put_att_ubyte(int ncid, int varid, const char *name,
495  nc_type xtype, size_t len, const unsigned char *value)
496 {
497  NC* ncp;
498  int stat = NC_check_id(ncid, &ncp);
499  if(stat != NC_NOERR) return stat;
500  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
501  (void *)value, NC_UBYTE);
502 }
503 
527 int
528 nc_put_att_ushort(int ncid, int varid, const char *name,
529  nc_type xtype, size_t len, const unsigned short *value)
530 {
531  NC* ncp;
532  int stat = NC_check_id(ncid, &ncp);
533  if(stat != NC_NOERR) return stat;
534  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
535  (void *)value, NC_USHORT);
536 }
537 
561 int
562 nc_put_att_uint(int ncid, int varid, const char *name,
563  nc_type xtype, size_t len, const unsigned int *value)
564 {
565  NC* ncp;
566  int stat = NC_check_id(ncid, &ncp);
567  if(stat != NC_NOERR) return stat;
568  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
569  (void *)value, NC_UINT);
570 }
571 
595 int
596 nc_put_att_longlong(int ncid, int varid, const char *name,
597  nc_type xtype, size_t len,
598  const long long *value)
599 {
600  NC* ncp;
601  int stat = NC_check_id(ncid, &ncp);
602  if(stat != NC_NOERR) return stat;
603  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
604  (void *)value, NC_INT64);
605 }
606 
630 int
631 nc_put_att_ulonglong(int ncid, int varid, const char *name,
632  nc_type xtype, size_t len,
633  const unsigned long long *value)
634 {
635  NC* ncp;
636  int stat = NC_check_id(ncid, &ncp);
637  if(stat != NC_NOERR) return stat;
638  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
639  (void *)value, NC_UINT64);
640 }
641  /* End doxygen member group. */
int nc_put_att(int ncid, int varid, const char *name, nc_type xtype, size_t len, const void *value)
Write an attribute of any type.
Definition: dattput.c:222
int nc_put_att_uint(int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned int *value)
Write an attribute of type unsigned int.
Definition: dattput.c:562
int nc_put_att_string(int ncid, int varid, const char *name, size_t len, const char **value)
Write a string attribute.
Definition: dattput.c:75
int nc_put_att_ubyte(int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned char *value)
Write an attribute of type unsigned char.
Definition: dattput.c:494
int nc_put_att_text(int ncid, int varid, const char *name, size_t len, const char *value)
Write a text attribute.
Definition: dattput.c:153
int nc_put_att_schar(int ncid, int varid, const char *name, nc_type xtype, size_t len, const signed char *value)
Write an attribute of type signed char.
Definition: dattput.c:256
int nc_put_att_ushort(int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned short *value)
Write an attribute of type unsigned short.
Definition: dattput.c:528
int nc_put_att_long(int ncid, int varid, const char *name, nc_type xtype, size_t len, const long *value)
Write an attribute of type long.
Definition: dattput.c:392
int nc_put_att_float(int ncid, int varid, const char *name, nc_type xtype, size_t len, const float *value)
Write an attribute of type float.
Definition: dattput.c:426
int nc_put_att_uchar(int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned char *value)
Write an attribute of type unsigned char.
Definition: dattput.c:290
int nc_put_att_longlong(int ncid, int varid, const char *name, nc_type xtype, size_t len, const long long *value)
Write an attribute of type long long.
Definition: dattput.c:596
int nc_put_att_ulonglong(int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned long long *value)
Write an attribute of type unsigned long long.
Definition: dattput.c:631
int nc_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_t len, const int *value)
Write an attribute of type int.
Definition: dattput.c:358
int nc_put_att_short(int ncid, int varid, const char *name, nc_type xtype, size_t len, const short *value)
Write an attribute of type short.
Definition: dattput.c:324
int nc_put_att_double(int ncid, int varid, const char *name, nc_type xtype, size_t len, const double *value)
Write an attribute of type double.
Definition: dattput.c:460
#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