NetCDF  4.4.1
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
dattput.c
Go to the documentation of this file.
1 
9 #include "ncdispatch.h"
10 
49 int
50 nc_put_att_string(int ncid, int varid, const char *name,
51  size_t len, const char** value)
52 {
53  NC* ncp;
54  int stat = NC_check_id(ncid, &ncp);
55  if(stat != NC_NOERR) return stat;
56  return ncp->dispatch->put_att(ncid, varid, name, NC_STRING,
57  len, (void*)value, NC_STRING);
58 }
59 
138 int nc_put_att_text(int ncid, int varid, const char *name,
139  size_t len, const char *value)
140 {
141  NC* ncp;
142  int stat = NC_check_id(ncid, &ncp);
143  if(stat != NC_NOERR) return stat;
144  return ncp->dispatch->put_att(ncid, varid, name, NC_CHAR, len,
145  (void *)value, NC_CHAR);
146 }
147 
228 int
229 nc_put_att(int ncid, int varid, const char *name, nc_type xtype,
230  size_t len, const void *value)
231 {
232  NC* ncp;
233  int stat = NC_check_id(ncid, &ncp);
234  if(stat != NC_NOERR) return stat;
235  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
236  value, xtype);
237 }
238 
239 int
240 nc_put_att_schar(int ncid, int varid, const char *name,
241  nc_type xtype, size_t len, const signed char *value)
242 {
243  NC *ncp;
244  int stat = NC_check_id(ncid, &ncp);
245  if(stat != NC_NOERR) return stat;
246  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
247  (void *)value, NC_BYTE);
248 }
249 
250 int
251 nc_put_att_uchar(int ncid, int varid, const char *name,
252  nc_type xtype, size_t len, const unsigned char *value)
253 {
254  NC* ncp;
255  int stat = NC_check_id(ncid, &ncp);
256  if(stat != NC_NOERR) return stat;
257  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
258  (void *)value, NC_UBYTE);
259 }
260 
261 int
262 nc_put_att_short(int ncid, int varid, const char *name,
263  nc_type xtype, size_t len, const short *value)
264 {
265  NC* ncp;
266  int stat = NC_check_id(ncid, &ncp);
267  if(stat != NC_NOERR) return stat;
268  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
269  (void *)value, NC_SHORT);
270 }
271 
272 int
273 nc_put_att_int(int ncid, int varid, const char *name,
274  nc_type xtype, size_t len, const int *value)
275 {
276  NC* ncp;
277  int stat = NC_check_id(ncid, &ncp);
278  if(stat != NC_NOERR) return stat;
279  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
280  (void *)value, NC_INT);
281 }
282 
283 int
284 nc_put_att_long(int ncid, int varid, const char *name,
285  nc_type xtype, size_t len, const long *value)
286 {
287  NC* ncp;
288  int stat = NC_check_id(ncid, &ncp);
289  if(stat != NC_NOERR) return stat;
290  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
291  (void *)value, longtype);
292 }
293 
294 int
295 nc_put_att_float(int ncid, int varid, const char *name,
296  nc_type xtype, size_t len, const float *value)
297 {
298  NC* ncp;
299  int stat = NC_check_id(ncid, &ncp);
300  if(stat != NC_NOERR) return stat;
301  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
302  (void *)value, NC_FLOAT);
303 }
304 
305 int
306 nc_put_att_double(int ncid, int varid, const char *name,
307  nc_type xtype, size_t len, const double *value)
308 {
309  NC* ncp;
310  int stat = NC_check_id(ncid, &ncp);
311  if(stat != NC_NOERR) return stat;
312  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
313  (void *)value, NC_DOUBLE);
314 }
315 
316 int
317 nc_put_att_ubyte(int ncid, int varid, const char *name,
318  nc_type xtype, size_t len, const unsigned char *value)
319 {
320  NC* ncp;
321  int stat = NC_check_id(ncid, &ncp);
322  if(stat != NC_NOERR) return stat;
323  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
324  (void *)value, NC_UBYTE);
325 }
326 
327 int
328 nc_put_att_ushort(int ncid, int varid, const char *name,
329  nc_type xtype, size_t len, const unsigned short *value)
330 {
331  NC* ncp;
332  int stat = NC_check_id(ncid, &ncp);
333  if(stat != NC_NOERR) return stat;
334  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
335  (void *)value, NC_USHORT);
336 }
337 
338 int
339 nc_put_att_uint(int ncid, int varid, const char *name,
340  nc_type xtype, size_t len, const unsigned int *value)
341 {
342  NC* ncp;
343  int stat = NC_check_id(ncid, &ncp);
344  if(stat != NC_NOERR) return stat;
345  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
346  (void *)value, NC_UINT);
347 }
348 
349 int
350 nc_put_att_longlong(int ncid, int varid, const char *name,
351  nc_type xtype, size_t len,
352  const long long *value)
353 {
354  NC* ncp;
355  int stat = NC_check_id(ncid, &ncp);
356  if(stat != NC_NOERR) return stat;
357  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
358  (void *)value, NC_INT64);
359 }
360 
361 int
362 nc_put_att_ulonglong(int ncid, int varid, const char *name,
363  nc_type xtype, size_t len,
364  const unsigned long long *value)
365 {
366  NC* ncp;
367  int stat = NC_check_id(ncid, &ncp);
368  if(stat != NC_NOERR) return stat;
369  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
370  (void *)value, NC_UINT64);
371 }
#define NC_CHAR
ISO/ASCII character.
Definition: netcdf.h:39
int nc_put_att_double(int ncid, int varid, const char *name, nc_type xtype, size_t len, const double *value)
Write an attribute.
Definition: dattput.c:306
#define NC_UBYTE
unsigned 1 byte int
Definition: netcdf.h:45
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.
Definition: dattput.c:328
#define NC_UINT
unsigned 4-byte int
Definition: netcdf.h:47
#define NC_INT64
signed 8-byte int
Definition: netcdf.h:48
#define NC_STRING
string
Definition: netcdf.h:50
#define NC_DOUBLE
double precision floating point number
Definition: netcdf.h:44
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.
Definition: dattput.c:317
int nc_type
The nc_type type is just an int.
Definition: netcdf.h:28
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.
Definition: dattput.c:240
#define NC_BYTE
signed 1 byte integer
Definition: netcdf.h:38
int nc_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_t len, const int *value)
Write an attribute.
Definition: dattput.c:273
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:138
int nc_put_att_short(int ncid, int varid, const char *name, nc_type xtype, size_t len, const short *value)
Write an attribute.
Definition: dattput.c:262
int nc_put_att_long(int ncid, int varid, const char *name, nc_type xtype, size_t len, const long *value)
Write an attribute.
Definition: dattput.c:284
#define NC_INT
signed 4 byte integer
Definition: netcdf.h:41
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.
Definition: dattput.c:251
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.
Definition: dattput.c:339
int nc_put_att(int ncid, int varid, const char *name, nc_type xtype, size_t len, const void *value)
Write an attribute.
Definition: dattput.c:229
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.
Definition: dattput.c:362
#define NC_USHORT
unsigned 2-byte int
Definition: netcdf.h:46
int nc_put_att_float(int ncid, int varid, const char *name, nc_type xtype, size_t len, const float *value)
Write an attribute.
Definition: dattput.c:295
#define NC_SHORT
signed 2 byte integer
Definition: netcdf.h:40
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.
Definition: dattput.c:350
#define NC_NOERR
No Error.
Definition: netcdf.h:315
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:50
#define NC_FLOAT
single precision floating point number
Definition: netcdf.h:43
#define NC_UINT64
unsigned 8-byte int
Definition: netcdf.h:49

Return to the Main Unidata NetCDF page.
Generated on Tue Aug 15 2017 19:06:53 for NetCDF. NetCDF is a Unidata library.