netCDF  4.2.1.1
 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 
222 int
223 nc_put_att(int ncid, int varid, const char *name, nc_type xtype,
224  size_t len, const void *value)
225 {
226  NC* ncp;
227  int stat = NC_check_id(ncid, &ncp);
228  if(stat != NC_NOERR) return stat;
229  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
230  value, xtype);
231 }
232 
233 int
234 nc_put_att_schar(int ncid, int varid, const char *name,
235  nc_type xtype, size_t len, const signed char *value)
236 {
237  NC *ncp;
238  int stat = NC_check_id(ncid, &ncp);
239  if(stat != NC_NOERR) return stat;
240  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
241  (void *)value, NC_BYTE);
242 }
243 
244 int
245 nc_put_att_uchar(int ncid, int varid, const char *name,
246  nc_type xtype, size_t len, const unsigned char *value)
247 {
248  NC* ncp;
249  int stat = NC_check_id(ncid, &ncp);
250  if(stat != NC_NOERR) return stat;
251  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
252  (void *)value, NC_UBYTE);
253 }
254 
255 int
256 nc_put_att_short(int ncid, int varid, const char *name,
257  nc_type xtype, size_t len, const short *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_SHORT);
264 }
265 
266 int
267 nc_put_att_int(int ncid, int varid, const char *name,
268  nc_type xtype, size_t len, const int *value)
269 {
270  NC* ncp;
271  int stat = NC_check_id(ncid, &ncp);
272  if(stat != NC_NOERR) return stat;
273  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
274  (void *)value, NC_INT);
275 }
276 
277 int
278 nc_put_att_long(int ncid, int varid, const char *name,
279  nc_type xtype, size_t len, const long *value)
280 {
281  NC* ncp;
282  int stat = NC_check_id(ncid, &ncp);
283  if(stat != NC_NOERR) return stat;
284  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
285  (void *)value, longtype);
286 }
287 
288 int
289 nc_put_att_float(int ncid, int varid, const char *name,
290  nc_type xtype, size_t len, const float *value)
291 {
292  NC* ncp;
293  int stat = NC_check_id(ncid, &ncp);
294  if(stat != NC_NOERR) return stat;
295  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
296  (void *)value, NC_FLOAT);
297 }
298 
299 int
300 nc_put_att_double(int ncid, int varid, const char *name,
301  nc_type xtype, size_t len, const double *value)
302 {
303  NC* ncp;
304  int stat = NC_check_id(ncid, &ncp);
305  if(stat != NC_NOERR) return stat;
306  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
307  (void *)value, NC_DOUBLE);
308 }
309 
310 int
311 nc_put_att_ubyte(int ncid, int varid, const char *name,
312  nc_type xtype, size_t len, const unsigned char *value)
313 {
314  NC* ncp;
315  int stat = NC_check_id(ncid, &ncp);
316  if(stat != NC_NOERR) return stat;
317  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
318  (void *)value, NC_UBYTE);
319 }
320 
321 int
322 nc_put_att_ushort(int ncid, int varid, const char *name,
323  nc_type xtype, size_t len, const unsigned short *value)
324 {
325  NC* ncp;
326  int stat = NC_check_id(ncid, &ncp);
327  if(stat != NC_NOERR) return stat;
328  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
329  (void *)value, NC_USHORT);
330 }
331 
332 int
333 nc_put_att_uint(int ncid, int varid, const char *name,
334  nc_type xtype, size_t len, const unsigned int *value)
335 {
336  NC* ncp;
337  int stat = NC_check_id(ncid, &ncp);
338  if(stat != NC_NOERR) return stat;
339  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
340  (void *)value, NC_UINT);
341 }
342 
343 int
344 nc_put_att_longlong(int ncid, int varid, const char *name,
345  nc_type xtype, size_t len,
346  const long long *value)
347 {
348  NC* ncp;
349  int stat = NC_check_id(ncid, &ncp);
350  if(stat != NC_NOERR) return stat;
351  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
352  (void *)value, NC_INT64);
353 }
354 
355 int
356 nc_put_att_ulonglong(int ncid, int varid, const char *name,
357  nc_type xtype, size_t len,
358  const unsigned long long *value)
359 {
360  NC* ncp;
361  int stat = NC_check_id(ncid, &ncp);
362  if(stat != NC_NOERR) return stat;
363  return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
364  (void *)value, NC_UINT64);
365 }
366 

Generated on Wed Aug 22 2012 14:39:31 for netCDF. NetCDF is a Unidata library.