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

Return to the Main Unidata NetCDF page.
Generated on Sat Apr 6 2019 08:19:00 for NetCDF. NetCDF is a Unidata library.