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

Generated on Tue Jul 9 2013 19:17:27 for netCDF. NetCDF is a Unidata library.