Coverage Report

Created: 2025-10-28 07:06

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/netcdf-c/libdispatch/dvarput.c
Line
Count
Source
1
/*! \file dvarput.c
2
Functions for writing data to variables.
3
4
Copyright 2018 University Corporation for Atmospheric
5
Research/Unidata. See COPYRIGHT file for more info.
6
*/
7
8
#include "ncdispatch.h"
9
10
struct PUTodometer {
11
    int            rank;
12
    size_t         index[NC_MAX_VAR_DIMS];
13
    size_t         start[NC_MAX_VAR_DIMS];
14
    size_t         edges[NC_MAX_VAR_DIMS];
15
    ptrdiff_t      stride[NC_MAX_VAR_DIMS];
16
    size_t         stop[NC_MAX_VAR_DIMS];
17
};
18
19
/**
20
 * @internal Initialize odometer.
21
 *
22
 * @param odom Pointer to odometer.
23
 * @param rank
24
 * @param start Start indices.
25
 * @param edges Counts.
26
 * @param stride Strides.
27
 *
28
 */
29
static void
30
odom_init(struct PUTodometer* odom, int rank, const size_t* start,
31
          const size_t* edges, const ptrdiff_t* stride)
32
0
{
33
0
    int i;
34
0
    memset(odom,0,sizeof(struct PUTodometer));
35
0
    odom->rank = rank;
36
0
    assert(odom->rank <= NC_MAX_VAR_DIMS);
37
0
    for(i=0;i<odom->rank;i++) {
38
0
  odom->start[i] = (start != NULL ? start[i] : 0);
39
0
  odom->edges[i] = (edges != NULL ? edges[i] : 1);
40
0
  odom->stride[i] = (stride != NULL ? stride[i] : 1);
41
0
  odom->stop[i] = odom->start[i] + (odom->edges[i]*(size_t)odom->stride[i]);
42
0
  odom->index[i] = odom->start[i];
43
0
    }
44
0
}
45
46
/**
47
 * @internal Return true if there is more.
48
 *
49
 * @param odom Pointer to odometer.
50
 *
51
 * @return True if there is more, 0 otherwise.
52
 */
53
static int
54
odom_more(struct PUTodometer* odom)
55
0
{
56
0
    return (odom->index[0] < odom->stop[0]);
57
0
}
58
59
/**
60
 * @internal Return true if there is more.
61
 *
62
 * @param odom Pointer to odometer.
63
 *
64
 * @return True if there is more, 0 otherwise.
65
 */
66
static int
67
odom_next(struct PUTodometer* odom)
68
0
{
69
0
    int i;
70
0
    if(odom->rank == 0) return 0;
71
0
    for(i=odom->rank-1;i>=0;i--) {
72
0
        odom->index[i] += (size_t)odom->stride[i];
73
0
        if(odom->index[i] < odom->stop[i]) break;
74
0
  if(i == 0) return 0; /* leave the 0th entry if it overflows*/
75
0
  odom->index[i] = odom->start[i]; /* reset this position*/
76
0
    }
77
0
    return 1;
78
0
}
79
80
/** \internal
81
\ingroup variables
82
*/
83
static int
84
NC_put_vara(int ncid, int varid, const size_t *start,
85
      const size_t *edges, const void *value, nc_type memtype)
86
0
{
87
0
   NC* ncp;
88
0
   size_t *my_count = (size_t *)edges;
89
90
0
   int stat = NC_check_id(ncid, &ncp);
91
0
   if(stat != NC_NOERR) return stat;
92
93
0
   if(start == NULL || edges == NULL) {
94
0
      stat = NC_check_nulls(ncid, varid, start, &my_count, NULL);
95
0
      if(stat != NC_NOERR) return stat;
96
0
   }
97
0
   stat = ncp->dispatch->put_vara(ncid, varid, start, my_count, value, memtype);
98
0
   if(edges == NULL) free(my_count);
99
0
   return stat;
100
0
}
101
102
/** \internal
103
\ingroup variables
104
*/
105
static int
106
NC_put_var(int ncid, int varid, const void *value, nc_type memtype)
107
0
{
108
0
   int ndims;
109
0
   size_t shape[NC_MAX_VAR_DIMS];
110
0
   int stat = nc_inq_varndims(ncid,varid, &ndims);
111
0
   if(stat) return stat;
112
0
   stat = NC_getshape(ncid,varid, ndims, shape);
113
0
   if(stat) return stat;
114
0
   return NC_put_vara(ncid, varid, NC_coord_zero, shape, value, memtype);
115
0
}
116
117
/** \internal
118
\ingroup variables
119
*/
120
static int
121
NC_put_var1(int ncid, int varid, const size_t *coord, const void* value,
122
      nc_type memtype)
123
0
{
124
0
   return NC_put_vara(ncid, varid, coord, NC_coord_one, value, memtype);
125
0
}
126
127
/** \internal
128
\ingroup variables
129
*/
130
int
131
NCDEFAULT_put_vars(int ncid, int varid, const size_t * start,
132
      const size_t * edges, const ptrdiff_t * stride,
133
      const void *value0, nc_type memtype)
134
0
{
135
  /* Rebuilt put_vars code to simplify and avoid use of put_varm */
136
137
0
   int status = NC_NOERR;
138
0
   int i,isstride1,isrecvar;
139
0
   int rank;
140
0
   struct PUTodometer odom;
141
0
   nc_type vartype = NC_NAT;
142
0
   NC* ncp;
143
0
   size_t vartypelen;
144
0
   size_t nels;
145
0
   int memtypelen;
146
0
   const char* value = (const char*)value0;
147
0
   int nrecdims;                /* number of record dims for a variable */
148
0
   int is_recdim[NC_MAX_VAR_DIMS]; /* for variable's dimensions */
149
0
   size_t varshape[NC_MAX_VAR_DIMS];
150
0
   size_t mystart[NC_MAX_VAR_DIMS];
151
0
   size_t myedges[NC_MAX_VAR_DIMS];
152
0
   ptrdiff_t mystride[NC_MAX_VAR_DIMS];
153
0
   const char* memptr = value;
154
155
0
   status = NC_check_id (ncid, &ncp);
156
0
   if(status != NC_NOERR) return status;
157
158
0
   status = nc_inq_vartype(ncid, varid, &vartype);
159
0
   if(status != NC_NOERR) return status;
160
161
0
   if(memtype == NC_NAT) memtype = vartype;
162
163
   /* compute the variable type size */
164
0
   status = nc_inq_type(ncid,vartype,NULL,&vartypelen);
165
0
   if(status != NC_NOERR) return status;
166
167
0
   if(memtype > NC_MAX_ATOMIC_TYPE)
168
0
  memtypelen = (int)vartypelen;
169
0
    else
170
0
  memtypelen = nctypelen(memtype);
171
172
   /* Check gross internal/external type compatibility */
173
0
   if(vartype != memtype) {
174
      /* If !atomic, the two types must be the same */
175
0
      if(vartype > NC_MAX_ATOMIC_TYPE
176
0
         || memtype > NC_MAX_ATOMIC_TYPE)
177
0
   return NC_EBADTYPE;
178
      /* ok, the types differ but both are atomic */
179
0
      if(memtype == NC_CHAR || vartype == NC_CHAR)
180
0
   return NC_ECHAR;
181
0
   }
182
183
   /* Get the variable rank */
184
0
   status = nc_inq_varndims(ncid, varid, &rank);
185
0
   if(status != NC_NOERR) return status;
186
187
   /* Start array is always required for non-scalar vars. */
188
0
   if(rank > 0 && start == NULL)
189
0
      return NC_EINVALCOORDS;
190
191
   /* Get variable dimension sizes */
192
0
   status = NC_inq_recvar(ncid,varid,&nrecdims,is_recdim);
193
0
   if(status != NC_NOERR) return status;
194
0
   isrecvar = (nrecdims > 0);
195
0
   NC_getshape(ncid,varid,rank,varshape);
196
197
   /* Optimize out using various checks */
198
0
   if (rank == 0) {
199
      /*
200
       * The variable is a scalar; consequently,
201
       * there is only one thing to get and only one place to put it.
202
       * (Why was I called?)
203
       */
204
0
      size_t edge1[1] = {1};
205
0
      return NC_put_vara(ncid, varid, start, edge1, value0, memtype);
206
0
   }
207
208
   /* Do various checks and fixups on start/edges/stride */
209
0
   isstride1 = 1; /* assume so */
210
0
   nels = 1;
211
0
   for(i=0;i<rank;i++) {
212
0
  size_t dimlen;
213
0
  mystart[i] = (start == NULL ? 0 : start[i]);
214
#if 0
215
  dimlen = (i == 0 && isrecvar ? numrecs : varshape[i]);
216
  if(i == 0 && isrecvar) {/*do nothing*/}
217
#else
218
        /* illegal value checks */
219
0
  dimlen = varshape[i];
220
0
  if(is_recdim[i]) {/*do nothing*/}
221
0
#endif
222
0
        else {
223
    /* mystart is unsigned, will never be < 0 */
224
0
    if (mystart[i] > dimlen) return NC_EINVALCOORDS;
225
0
       }
226
0
  if(edges == NULL) {
227
#if 0
228
     if(i == 0 && isrecvar)
229
          myedges[i] = numrecs - start[i];
230
#else
231
0
     if(is_recdim[i] && isrecvar)
232
0
          myedges[i] = varshape[i] - start[i];
233
0
#endif
234
0
     else
235
0
        myedges[i] = varshape[i] - mystart[i];
236
0
  } else
237
0
      myedges[i] = edges[i];
238
239
0
  if(!is_recdim[i]) {
240
0
    if (mystart[i] == dimlen && myedges[i] > 0)
241
0
              return NC_EINVALCOORDS;
242
0
        }
243
244
0
  if(!is_recdim[i]) {
245
          /* myediges is unsigned, will never be < 0 */
246
0
    if(mystart[i] + myedges[i] > dimlen)
247
0
      return NC_EEDGE;
248
0
        }
249
0
  mystride[i] = (stride == NULL ? 1 : stride[i]);
250
0
  if(mystride[i] <= 0
251
     /* cast needed for braindead systems with signed size_t */
252
0
           || ((unsigned long) mystride[i] >= X_INT_MAX))
253
0
           return NC_ESTRIDE;
254
0
    if(mystride[i] != 1) isstride1 = 0;
255
0
        nels *= myedges[i];
256
0
   }
257
   
258
0
   if(isstride1) {
259
0
      return NC_put_vara(ncid, varid, mystart, myedges, value, memtype);
260
0
   }
261
262
0
   if(nels == 0) {
263
      /* This should be here instead of before NC_put_vara call to 
264
       * avoid hang in parallel write for single stride.
265
       * Still issue with parallel hang if stride > 1
266
       */
267
0
      return NC_NOERR; /* cannot write anything */
268
0
   }
269
     
270
   /* Initial version uses and odometer to walk the variable
271
      and read each value one at a time. This can later be optimized
272
      to read larger chunks at a time.
273
    */
274
275
276
0
   odom_init(&odom,rank,mystart,myedges,mystride);
277
278
   /* walk the odometer to extract values */
279
0
   while(odom_more(&odom)) {
280
0
      int localstatus = NC_NOERR;
281
      /* Write a single value */
282
0
      localstatus = NC_put_vara(ncid,varid,odom.index,NC_coord_one,memptr,memtype);
283
      /* So it turns out that when get_varm is used, all errors are
284
         delayed and ERANGE will be overwritten by more serious errors.
285
      */
286
0
      if(localstatus != NC_NOERR) {
287
0
      if(status == NC_NOERR || localstatus != NC_ERANGE)
288
0
         status = localstatus;
289
0
      }
290
0
      memptr += memtypelen;
291
0
      odom_next(&odom);
292
0
   }
293
0
   return status;
294
0
}
295
296
/** \internal
297
\ingroup variables
298
*/
299
int
300
NCDEFAULT_put_varm(
301
   int ncid,
302
   int varid,
303
   const size_t * start,
304
   const size_t * edges,
305
   const ptrdiff_t * stride,
306
   const ptrdiff_t * imapp,
307
   const void *value0,
308
   nc_type memtype)
309
0
{
310
0
   int status = NC_NOERR;
311
0
   nc_type vartype = NC_NAT;
312
0
   int varndims = 0;
313
0
   int maxidim = 0;
314
0
   NC* ncp;
315
0
   int memtypelen;
316
0
   const char* value = (char*)value0;
317
318
0
   status = NC_check_id (ncid, &ncp);
319
0
   if(status != NC_NOERR) return status;
320
321
/*
322
  if(NC_indef(ncp)) return NC_EINDEFINE;
323
  if(NC_readonly (ncp)) return NC_EPERM;
324
*/
325
326
   /* mid body */
327
0
   status = nc_inq_vartype(ncid, varid, &vartype);
328
0
   if(status != NC_NOERR) return status;
329
   /* Check that this is an atomic type */
330
0
   if(vartype > NC_MAX_ATOMIC_TYPE)
331
0
  return NC_EMAPTYPE;
332
333
0
   status = nc_inq_varndims(ncid, varid, &varndims);
334
0
   if(status != NC_NOERR) return status;
335
336
0
   if(memtype == NC_NAT) {
337
0
      memtype = vartype;
338
0
   }
339
340
0
   if(memtype == NC_CHAR && vartype != NC_CHAR)
341
0
      return NC_ECHAR;
342
0
   else if(memtype != NC_CHAR && vartype == NC_CHAR)
343
0
      return NC_ECHAR;
344
345
0
   memtypelen = nctypelen(memtype);
346
347
0
   maxidim = (int) varndims - 1;
348
349
0
   if (maxidim < 0)
350
0
   {
351
      /*
352
       * The variable is a scalar; consequently,
353
       * there s only one thing to get and only one place to put it.
354
       * (Why was I called?)
355
       */
356
0
      size_t edge1[1] = {1};
357
0
      return NC_put_vara(ncid, varid, start, edge1, value, memtype);
358
0
   }
359
360
   /*
361
    * else
362
    * The variable is an array.
363
    */
364
0
   {
365
0
      int idim;
366
0
      size_t *mystart = NULL;
367
0
      size_t *myedges = 0;
368
0
      size_t *iocount= 0;    /* count vector */
369
0
      size_t *stop = 0;   /* stop indexes */
370
0
      size_t *length = 0; /* edge lengths in bytes */
371
0
      ptrdiff_t *mystride = 0;
372
0
      ptrdiff_t *mymap= 0;
373
0
      size_t varshape[NC_MAX_VAR_DIMS];
374
0
      int isrecvar;
375
0
      size_t numrecs;
376
0
      int stride1; /* is stride all ones? */
377
378
      /*
379
       * Verify stride argument.
380
       */
381
0
      stride1 = 1;    /*  assume ok; */
382
0
      if(stride != NULL) {
383
0
   for (idim = 0; idim <= maxidim; ++idim) {
384
0
            if ((stride[idim] == 0)
385
    /* cast needed for braindead systems with signed size_t */
386
0
                || ((unsigned long) stride[idim] >= X_INT_MAX))
387
0
      {
388
0
         return NC_ESTRIDE;
389
0
            }
390
0
      if(stride[idim] != 1) stride1 = 0;
391
0
   }
392
0
      }
393
394
      /* If stride1 is true, and there is no imap, then call get_vara
395
         directly
396
      */
397
0
      if(stride1 && imapp == NULL) {
398
0
   return NC_put_vara(ncid, varid, start, edges, value, memtype);
399
0
      }
400
401
      /* Compute some dimension related values */
402
0
      isrecvar = NC_is_recvar(ncid,varid,&numrecs);
403
0
      NC_getshape(ncid,varid,varndims,varshape);
404
405
      /* assert(sizeof(ptrdiff_t) >= sizeof(size_t)); */
406
0
      mystart = (size_t *)calloc((size_t)(varndims * 7), sizeof(ptrdiff_t));
407
0
      if(mystart == NULL) return NC_ENOMEM;
408
0
      myedges = mystart + varndims;
409
0
      iocount = myedges + varndims;
410
0
      stop = iocount + varndims;
411
0
      length = stop + varndims;
412
0
      mystride = (ptrdiff_t *)(length + varndims);
413
0
      mymap = mystride + varndims;
414
415
      /*
416
       * Check start, edges
417
       */
418
0
      for (idim = maxidim; idim >= 0; --idim)
419
0
      {
420
0
   mystart[idim] = start != NULL
421
0
      ? start[idim]
422
0
      : 0;
423
424
0
   myedges[idim] = edges != NULL
425
0
      ? edges[idim]
426
0
      : idim == 0 && isrecvar
427
0
              ? numrecs - mystart[idim]
428
0
          : varshape[idim] - mystart[idim];
429
0
      }
430
431
0
      for (idim = isrecvar; idim <= maxidim; ++idim)
432
0
      {
433
0
   if (mystart[idim] > varshape[idim] ||
434
0
      (mystart[idim] == varshape[idim] && myedges[idim] > 0))
435
0
   {
436
0
      status = NC_EINVALCOORDS;
437
0
      goto done;
438
0
   }
439
440
0
   if (mystart[idim] + myedges[idim] > varshape[idim])
441
0
   {
442
0
      status = NC_EEDGE;
443
0
      goto done;
444
0
   }
445
0
      }
446
447
      /*
448
       * Initialize I/O parameters.
449
       */
450
0
      for (idim = maxidim; idim >= 0; --idim)
451
0
      {
452
0
   if (edges != NULL && edges[idim] == 0)
453
0
   {
454
0
      status = NC_NOERR;    /* read/write no data */
455
0
      goto done;
456
0
   }
457
458
0
   mystride[idim] = stride != NULL
459
0
      ? stride[idim]
460
0
      : 1;
461
0
   mymap[idim] = imapp != NULL
462
0
      ? imapp[idim]
463
0
      : idim == maxidim
464
0
          ? 1
465
0
          : mymap[idim + 1] * (ptrdiff_t) myedges[idim + 1];
466
467
0
   iocount[idim] = 1;
468
0
   length[idim] = ((size_t)mymap[idim]) * myedges[idim];
469
0
   stop[idim] = mystart[idim] + myedges[idim] * (size_t)mystride[idim];
470
0
      }
471
472
      /* Lower body */
473
      /*
474
       * As an optimization, adjust I/O parameters when the fastest
475
       * dimension has unity stride both externally and internally.
476
       * In this case, the user could have called a simpler routine
477
       * (i.e. ncvar$1()
478
       */
479
0
      if (mystride[maxidim] == 1
480
0
    && mymap[maxidim] == 1)
481
0
      {
482
0
   iocount[maxidim] = myedges[maxidim];
483
0
   mystride[maxidim] = (ptrdiff_t) myedges[maxidim];
484
0
   mymap[maxidim] = (ptrdiff_t) length[maxidim];
485
0
      }
486
487
      /*
488
       * Perform I/O.  Exit when done.
489
       */
490
0
      for (;;)
491
0
      {
492
   /* TODO: */
493
0
   int lstatus = NC_put_vara(ncid, varid, mystart, iocount,
494
0
           value, memtype);
495
0
   if (lstatus != NC_NOERR) {
496
0
      if(status == NC_NOERR || lstatus != NC_ERANGE)
497
0
         status = lstatus;
498
0
   }
499
500
   /*
501
    * The following code permutes through the variable s
502
    * external start-index space and it s internal address
503
    * space.  At the UPC, this algorithm is commonly
504
    * called "odometer code".
505
    */
506
0
   idim = maxidim;
507
0
        carry:
508
0
   value += (mymap[idim] * memtypelen);
509
0
   mystart[idim] += (size_t)mystride[idim];
510
0
   if (mystart[idim] == stop[idim])
511
0
   {
512
0
      size_t l = (length[idim] * (size_t)memtypelen);
513
0
      value -= l;
514
0
      mystart[idim] = start[idim];
515
0
      if (--idim < 0)
516
0
         break; /* normal return */
517
0
      goto carry;
518
0
   }
519
0
      } /* I/O loop */
520
0
     done:
521
0
      free(mystart);
522
0
   } /* variable is array */
523
0
   return status;
524
0
}
525
526
/** \internal
527
\ingroup variables
528
*/
529
static int
530
NC_put_vars(int ncid, int varid, const size_t *start,
531
      const size_t *edges, const ptrdiff_t *stride,
532
      const void *value, nc_type memtype)
533
0
{
534
0
   NC* ncp;
535
0
   size_t *my_count = (size_t *)edges;
536
0
   ptrdiff_t *my_stride = (ptrdiff_t *)stride;
537
0
   int stat;
538
539
0
   stat = NC_check_id(ncid, &ncp);
540
0
   if(stat != NC_NOERR) return stat;
541
542
   /* Handle any NULL parameters. */
543
0
   if(start == NULL || edges == NULL || stride == NULL) {
544
0
      stat = NC_check_nulls(ncid, varid, start, &my_count, &my_stride);
545
0
      if(stat != NC_NOERR) return stat;
546
0
   }
547
548
0
   stat = ncp->dispatch->put_vars(ncid, varid, start, my_count, my_stride,
549
0
                                  value, memtype);
550
0
   if(edges == NULL) free(my_count);
551
0
   if(stride == NULL) free(my_stride);
552
0
   return stat;
553
0
}
554
555
/** \internal
556
\ingroup variables
557
*/
558
static int
559
NC_put_varm(int ncid, int varid, const size_t *start,
560
      const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t* map,
561
      const void *value, nc_type memtype)
562
0
{
563
0
   NC* ncp;
564
0
   size_t *my_count = (size_t *)edges;
565
0
   ptrdiff_t *my_stride = (ptrdiff_t *)stride;
566
0
   int stat;
567
568
0
   stat = NC_check_id(ncid, &ncp);
569
0
   if(stat != NC_NOERR) return stat;
570
571
   /* Handle any NULL parameters. */
572
0
   if(start == NULL || edges == NULL || stride == NULL) {
573
0
      stat = NC_check_nulls(ncid, varid, start, &my_count, &my_stride);
574
0
      if(stat != NC_NOERR) return stat;
575
0
   }
576
577
0
   stat = ncp->dispatch->put_varm(ncid, varid, start, my_count, my_stride,
578
0
                                  map, value, memtype);
579
0
   if(edges == NULL) free(my_count);
580
0
   if(stride == NULL) free(my_stride);
581
0
   return stat;
582
0
}
583
584
/** \name Writing Data to Variables
585
586
Functions to write data from variables. */
587
/*! \{ */ /* All these functions are part of this named group... */
588
589
/** \ingroup variables
590
Write an array of values to a variable.
591
592
The values to be written are associated with the netCDF variable by
593
assuming that the last dimension of the netCDF variable varies fastest
594
in the C interface. The netCDF dataset must be in data mode. The array
595
to be written is specified by giving a corner and a vector of edge
596
lengths to \ref specify_hyperslab.
597
598
The functions for types ubyte, ushort, uint, longlong, ulonglong, and
599
string are only available for netCDF-4/HDF5 files.
600
601
The nc_put_var() function will write a variable of any type, including
602
user defined type. For this function, the type of the data in memory
603
must match the type of the variable - no data conversion is done.
604
605
\param ncid NetCDF or group ID, from a previous call to nc_open(),
606
nc_create(), nc_def_grp(), or associated inquiry functions such as
607
nc_inq_ncid().
608
609
\param varid Variable ID
610
611
\param startp Start vector with one element for each dimension to \ref
612
specify_hyperslab. This array must be same size as variable's number
613
of dimensions.
614
615
\param countp Count vector with one element for each dimension to \ref
616
specify_hyperslab. This array must be same size as variable's number
617
of dimensions.
618
619
\param op Pointer where the data will be copied. Memory must be
620
allocated by the user before this function is called.
621
622
\returns ::NC_NOERR No error.
623
\returns ::NC_ENOTVAR Variable not found.
624
\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
625
\returns ::NC_EEDGE Start+count exceeds dimension bound.
626
\returns ::NC_ERANGE One or more of the values are out of range.
627
\returns ::NC_EINDEFINE Operation not allowed in define mode.
628
\returns ::NC_EBADID Bad ncid.
629
\author Glenn Davis, Russ Rew, Ed Hartnett, Dennis Heimbigner, Ward Fisher
630
 */
631
/**@{*/
632
int
633
nc_put_vara(int ncid, int varid, const size_t *startp,
634
      const size_t *countp, const void *op)
635
0
{
636
0
   NC* ncp;
637
0
   int stat = NC_check_id(ncid, &ncp);
638
0
   nc_type xtype;
639
0
   if(stat != NC_NOERR) return stat;
640
0
   stat = nc_inq_vartype(ncid, varid, &xtype);
641
0
   if(stat != NC_NOERR) return stat;
642
0
   return NC_put_vara(ncid, varid, startp, countp, op, xtype);
643
0
}
644
645
int
646
nc_put_vara_text(int ncid, int varid, const size_t *startp,
647
     const size_t *countp, const char *op)
648
0
{
649
0
   return NC_put_vara(ncid, varid, startp, countp,
650
0
          (void*)op, NC_CHAR);
651
0
}
652
653
int
654
nc_put_vara_schar(int ncid, int varid, const size_t *startp,
655
      const size_t *countp, const signed char *op)
656
0
{
657
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
658
0
          NC_BYTE);
659
0
}
660
661
int
662
nc_put_vara_uchar(int ncid, int varid, const size_t *startp,
663
      const size_t *countp, const unsigned char *op)
664
0
{
665
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
666
0
          T_uchar);
667
0
}
668
669
int
670
nc_put_vara_short(int ncid, int varid, const size_t *startp,
671
      const size_t *countp, const short *op)
672
0
{
673
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
674
0
          NC_SHORT);
675
0
}
676
677
int
678
nc_put_vara_int(int ncid, int varid, const size_t *startp,
679
    const size_t *countp, const int *op)
680
0
{
681
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
682
0
          NC_INT);
683
0
}
684
685
int
686
nc_put_vara_long(int ncid, int varid, const size_t *startp,
687
     const size_t *countp, const long *op)
688
0
{
689
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
690
0
          T_long);
691
0
}
692
693
int
694
nc_put_vara_float(int ncid, int varid, const size_t *startp,
695
      const size_t *countp, const float *op)
696
0
{
697
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
698
0
          T_float);
699
0
}
700
701
int
702
nc_put_vara_double(int ncid, int varid, const size_t *startp,
703
       const size_t *countp, const double *op)
704
0
{
705
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
706
0
          T_double);
707
0
}
708
709
int
710
nc_put_vara_ubyte(int ncid, int varid, const size_t *startp,
711
      const size_t *countp, const unsigned char *op)
712
0
{
713
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
714
0
          T_ubyte);
715
0
}
716
717
int
718
nc_put_vara_ushort(int ncid, int varid, const size_t *startp,
719
       const size_t *countp, const unsigned short *op)
720
0
{
721
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
722
0
          T_ushort);
723
0
}
724
725
int
726
nc_put_vara_uint(int ncid, int varid, const size_t *startp,
727
     const size_t *countp, const unsigned int *op)
728
0
{
729
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
730
0
          T_uint);
731
0
}
732
733
int
734
nc_put_vara_longlong(int ncid, int varid, const size_t *startp,
735
         const size_t *countp, const long long *op)
736
0
{
737
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
738
0
          T_longlong);
739
0
}
740
741
int
742
nc_put_vara_ulonglong(int ncid, int varid, const size_t *startp,
743
          const size_t *countp, const unsigned long long *op)
744
0
{
745
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
746
0
          NC_UINT64);
747
0
}
748
749
int
750
nc_put_vara_string(int ncid, int varid, const size_t *startp,
751
       const size_t *countp, const char* *op)
752
0
{
753
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
754
0
          NC_STRING);
755
0
}
756
757
/**@}*/
758
759
/** \ingroup variables
760
Write one datum.
761
762
\param ncid NetCDF or group ID, from a previous call to nc_open(),
763
nc_create(), nc_def_grp(), or associated inquiry functions such as
764
nc_inq_ncid().
765
766
\param varid Variable ID
767
768
\param indexp Index vector with one element for each dimension.
769
770
\param op Pointer from where the data will be copied.
771
772
\returns ::NC_NOERR No error.
773
\returns ::NC_ENOTVAR Variable not found.
774
\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
775
\returns ::NC_EEDGE Start+count exceeds dimension bound.
776
\returns ::NC_ERANGE One or more of the values are out of range.
777
\returns ::NC_EINDEFINE Operation not allowed in define mode.
778
\returns ::NC_EBADID Bad ncid.
779
\author Glenn Davis, Russ Rew, Ed Hartnett, Dennis Heimbigner, Ward Fisher
780
 */
781
/**@{*/
782
int
783
nc_put_var1(int ncid, int varid, const size_t *indexp, const void *op)
784
0
{
785
0
   return NC_put_var1(ncid, varid, indexp, op, NC_NAT);
786
0
}
787
788
int
789
nc_put_var1_text(int ncid, int varid, const size_t *indexp, const char *op)
790
0
{
791
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_CHAR);
792
0
}
793
794
int
795
nc_put_var1_schar(int ncid, int varid, const size_t *indexp, const signed char *op)
796
0
{
797
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_BYTE);
798
0
}
799
800
int
801
nc_put_var1_uchar(int ncid, int varid, const size_t *indexp, const unsigned char *op)
802
0
{
803
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_UBYTE);
804
0
}
805
806
int
807
nc_put_var1_short(int ncid, int varid, const size_t *indexp, const short *op)
808
0
{
809
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_SHORT);
810
0
}
811
812
int
813
nc_put_var1_int(int ncid, int varid, const size_t *indexp, const int *op)
814
0
{
815
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_INT);
816
0
}
817
818
int
819
nc_put_var1_long(int ncid, int varid, const size_t *indexp, const long *op)
820
0
{
821
0
   return NC_put_var1(ncid, varid, indexp, (void*)op, longtype);
822
0
}
823
824
int
825
nc_put_var1_float(int ncid, int varid, const size_t *indexp, const float *op)
826
0
{
827
0
   return NC_put_var1(ncid, varid, indexp, (void*)op, NC_FLOAT);
828
0
}
829
830
int
831
nc_put_var1_double(int ncid, int varid, const size_t *indexp, const double *op)
832
0
{
833
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_DOUBLE);
834
0
}
835
836
int
837
nc_put_var1_ubyte(int ncid, int varid, const size_t *indexp, const unsigned char *op)
838
0
{
839
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_UBYTE);
840
0
}
841
842
int
843
nc_put_var1_ushort(int ncid, int varid, const size_t *indexp, const unsigned short *op)
844
0
{
845
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_USHORT);
846
0
}
847
848
int
849
nc_put_var1_uint(int ncid, int varid, const size_t *indexp, const unsigned int *op)
850
0
{
851
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_UINT);
852
0
}
853
854
int
855
nc_put_var1_longlong(int ncid, int varid, const size_t *indexp, const long long *op)
856
0
{
857
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_INT64);
858
0
}
859
860
int
861
nc_put_var1_ulonglong(int ncid, int varid, const size_t *indexp, const unsigned long long *op)
862
0
{
863
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_UINT64);
864
0
}
865
866
int
867
nc_put_var1_string(int ncid, int varid, const size_t *indexp, const char* *op)
868
0
{
869
0
   return NC_put_var1(ncid, varid, indexp, (void*)op, NC_STRING);
870
0
}
871
872
/**@}*/
873
874
/** \ingroup variables
875
Write an entire variable with one call.
876
877
The nc_put_var_ type family of functions write all the values of a
878
variable into a netCDF variable of an open netCDF dataset. This is the
879
simplest interface to use for writing a value in a scalar variable or
880
whenever all the values of a multidimensional variable can all be
881
written at once. The values to be written are associated with the
882
netCDF variable by assuming that the last dimension of the netCDF
883
variable varies fastest in the C interface. The values are converted
884
to the external data type of the variable, if necessary.
885
886
Take care when using this function with record variables (variables
887
that use the ::NC_UNLIMITED dimension). If you try to write all the
888
values of a record variable into a netCDF file that has no record data
889
yet (hence has 0 records), nothing will be written. Similarly, if you
890
try to write all the values of a record variable but there are more
891
records in the file than you assume, more in-memory data will be
892
accessed than you supply, which may result in a segmentation
893
violation. To avoid such problems, it is better to use the nc_put_vara
894
interfaces for variables that use the ::NC_UNLIMITED dimension.
895
896
The functions for types ubyte, ushort, uint, longlong, ulonglong, and
897
string are only available for netCDF-4/HDF5 files.
898
899
The nc_put_var() function will write a variable of any type, including
900
user defined type. For this function, the type of the data in memory
901
must match the type of the variable - no data conversion is done.
902
903
\param ncid NetCDF or group ID, from a previous call to nc_open(),
904
nc_create(), nc_def_grp(), or associated inquiry functions such as
905
nc_inq_ncid().
906
907
\param varid Variable ID
908
909
\param op Pointer from where the data will be copied.
910
911
\returns ::NC_NOERR No error.
912
\returns ::NC_ENOTVAR Variable not found.
913
\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
914
\returns ::NC_EEDGE Start+count exceeds dimension bound.
915
\returns ::NC_ERANGE One or more of the values are out of range.
916
\returns ::NC_EINDEFINE Operation not allowed in define mode.
917
\returns ::NC_EBADID Bad ncid.
918
\author Glenn Davis, Russ Rew, Ed Hartnett, Dennis Heimbigner, Ward Fisher
919
 */
920
/**@{*/
921
int
922
nc_put_var(int ncid, int varid, const void *op)
923
0
{
924
0
   return NC_put_var(ncid, varid, op, NC_NAT);
925
0
}
926
927
int
928
nc_put_var_text(int ncid, int varid, const char *op)
929
0
{
930
0
   return NC_put_var(ncid,varid,(void*)op,NC_CHAR);
931
0
}
932
933
int
934
nc_put_var_schar(int ncid, int varid, const signed char *op)
935
0
{
936
0
   return NC_put_var(ncid,varid,(void*)op,NC_BYTE);
937
0
}
938
939
int
940
nc_put_var_uchar(int ncid, int varid, const unsigned char *op)
941
0
{
942
0
   return NC_put_var(ncid,varid,(void*)op,T_uchar);
943
0
}
944
945
int
946
nc_put_var_short(int ncid, int varid, const short *op)
947
0
{
948
0
   return NC_put_var(ncid,varid,(void*)op,NC_SHORT);
949
0
}
950
951
int
952
nc_put_var_int(int ncid, int varid, const int *op)
953
0
{
954
0
   return NC_put_var(ncid,varid,(void*)op,NC_INT);
955
0
}
956
957
int
958
nc_put_var_long(int ncid, int varid, const long *op)
959
0
{
960
0
   return NC_put_var(ncid,varid,(void*)op,T_long);
961
0
}
962
963
int
964
nc_put_var_float(int ncid, int varid, const float *op)
965
0
{
966
0
   return NC_put_var(ncid,varid,(void*)op,T_float);
967
0
}
968
969
int
970
nc_put_var_double(int ncid, int varid, const double *op)
971
0
{
972
0
   return NC_put_var(ncid,varid,(void*)op,T_double);
973
0
}
974
975
int
976
nc_put_var_ubyte(int ncid, int varid, const unsigned char *op)
977
0
{
978
0
   return NC_put_var(ncid,varid,(void*)op,T_ubyte);
979
0
}
980
981
int
982
nc_put_var_ushort(int ncid, int varid, const unsigned short *op)
983
0
{
984
0
   return NC_put_var(ncid,varid,(void*)op,T_ushort);
985
0
}
986
987
int
988
nc_put_var_uint(int ncid, int varid, const unsigned int *op)
989
0
{
990
0
   return NC_put_var(ncid,varid,(void*)op,T_uint);
991
0
}
992
993
int
994
nc_put_var_longlong(int ncid, int varid, const long long *op)
995
0
{
996
0
   return NC_put_var(ncid,varid,(void*)op,T_longlong);
997
0
}
998
999
int
1000
nc_put_var_ulonglong(int ncid, int varid, const unsigned long long *op)
1001
0
{
1002
0
   return NC_put_var(ncid,varid,(void*)op,NC_UINT64);
1003
0
}
1004
1005
int
1006
nc_put_var_string(int ncid, int varid, const char* *op)
1007
0
{
1008
0
   return NC_put_var(ncid,varid,(void*)op,NC_STRING);
1009
0
}
1010
1011
/**\} */
1012
1013
/** \ingroup variables
1014
Write a strided array of values to a variable.
1015
1016
\param ncid NetCDF or group ID, from a previous call to nc_open(),
1017
nc_create(), nc_def_grp(), or associated inquiry functions such as
1018
nc_inq_ncid().
1019
1020
\param varid Variable ID
1021
1022
\param startp Start vector with one element for each dimension to \ref
1023
specify_hyperslab. This array must be same size as variable's number
1024
of dimensions.
1025
1026
\param countp Count vector with one element for each dimension to \ref
1027
specify_hyperslab. This array must be same size as variable's number
1028
of dimensions.
1029
1030
\param stridep Stride vector with one element for each dimension to
1031
\ref specify_hyperslab. This array must be same size as variable's
1032
number of dimensions.
1033
1034
\param op Pointer where the data will be copied. Memory must be
1035
allocated by the user before this function is called.
1036
1037
\returns ::NC_NOERR No error.
1038
\returns ::NC_ENOTVAR Variable not found.
1039
\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
1040
\returns ::NC_EEDGE Start+count exceeds dimension bound.
1041
\returns ::NC_ERANGE One or more of the values are out of range.
1042
\returns ::NC_EINDEFINE Operation not allowed in define mode.
1043
\returns ::NC_EBADID Bad ncid.
1044
\author Glenn Davis, Russ Rew, Ed Hartnett, Dennis Heimbigner, Ward Fisher
1045
 */
1046
/**@{*/
1047
int
1048
nc_put_vars(int ncid, int varid, const size_t *startp,
1049
       const size_t *countp, const ptrdiff_t *stridep,
1050
       const void *op)
1051
0
{
1052
0
   return NC_put_vars(ncid, varid, startp, countp, stridep, op, NC_NAT);
1053
0
}
1054
1055
int
1056
nc_put_vars_text(int ncid, int varid, const size_t *startp,
1057
     const size_t *countp, const ptrdiff_t *stridep,
1058
     const char *op)
1059
0
{
1060
0
   return NC_put_vars(ncid, varid, startp, countp,
1061
0
          stridep,(void*)op,NC_CHAR);
1062
0
}
1063
1064
int
1065
nc_put_vars_schar(int ncid, int varid, const size_t *startp,
1066
      const size_t *countp, const ptrdiff_t *stridep,
1067
      const signed char *op)
1068
0
{
1069
0
   return NC_put_vars(ncid, varid, startp, countp,
1070
0
          stridep,(void*)op,NC_BYTE);
1071
0
}
1072
1073
int
1074
nc_put_vars_uchar(int ncid, int varid,
1075
      const size_t *startp, const size_t *countp,
1076
      const ptrdiff_t *stridep,
1077
      const unsigned char *op)
1078
0
{
1079
0
   return NC_put_vars(ncid, varid, startp, countp,
1080
0
          stridep, (void *)op, T_uchar);
1081
0
}
1082
1083
int
1084
nc_put_vars_short(int ncid, int varid,
1085
      const size_t *startp, const size_t *countp,
1086
      const ptrdiff_t *stridep,
1087
      const short *op)
1088
0
{
1089
0
   return NC_put_vars(ncid, varid, startp, countp,
1090
0
          stridep, (void *)op, NC_SHORT);
1091
0
}
1092
1093
int
1094
nc_put_vars_int(int ncid, int varid,
1095
    const size_t *startp, const size_t *countp,
1096
    const ptrdiff_t *stridep,
1097
    const int *op)
1098
0
{
1099
0
   return NC_put_vars(ncid, varid, startp, countp,
1100
0
          stridep, (void *)op, NC_INT);
1101
0
}
1102
1103
int
1104
nc_put_vars_long(int ncid, int varid,
1105
     const size_t *startp, const size_t *countp,
1106
     const ptrdiff_t *stridep,
1107
     const long *op)
1108
0
{
1109
0
   return NC_put_vars(ncid, varid, startp, countp,
1110
0
          stridep, (void *)op, T_long);
1111
0
}
1112
1113
int
1114
nc_put_vars_float(int ncid, int varid,
1115
      const size_t *startp, const size_t *countp,
1116
      const ptrdiff_t *stridep,
1117
      const float *op)
1118
0
{
1119
0
   return NC_put_vars(ncid, varid, startp, countp,
1120
0
          stridep, (void *)op, T_float);
1121
0
}
1122
1123
int
1124
nc_put_vars_double(int ncid, int varid,
1125
       const size_t *startp, const size_t *countp,
1126
       const ptrdiff_t *stridep,
1127
       const double *op)
1128
0
{
1129
0
   return NC_put_vars(ncid, varid, startp, countp,
1130
0
          stridep, (void *)op, T_double);
1131
0
}
1132
1133
int
1134
nc_put_vars_ubyte(int ncid, int varid,
1135
      const size_t *startp, const size_t *countp,
1136
      const ptrdiff_t *stridep,
1137
      const unsigned char *op)
1138
0
{
1139
0
   return NC_put_vars(ncid, varid, startp, countp,
1140
0
          stridep, (void *)op, T_ubyte);
1141
0
}
1142
1143
int
1144
nc_put_vars_ushort(int ncid, int varid,
1145
       const size_t *startp, const size_t *countp,
1146
       const ptrdiff_t *stridep,
1147
       const unsigned short *op)
1148
0
{
1149
0
   return NC_put_vars(ncid, varid, startp, countp,
1150
0
          stridep, (void *)op, T_ushort);
1151
0
}
1152
1153
int
1154
nc_put_vars_uint(int ncid, int varid,
1155
     const size_t *startp, const size_t *countp,
1156
     const ptrdiff_t *stridep,
1157
     const unsigned int *op)
1158
0
{
1159
0
   return NC_put_vars(ncid, varid, startp, countp,
1160
0
          stridep, (void *)op, T_uint);
1161
0
}
1162
1163
int
1164
nc_put_vars_longlong(int ncid, int varid,
1165
         const size_t *startp, const size_t *countp,
1166
         const ptrdiff_t *stridep,
1167
         const long long *op)
1168
0
{
1169
0
   return NC_put_vars(ncid, varid, startp, countp,
1170
0
          stridep, (void *)op, T_longlong);
1171
0
}
1172
1173
int
1174
nc_put_vars_ulonglong(int ncid, int varid,
1175
          const size_t *startp, const size_t *countp,
1176
          const ptrdiff_t *stridep,
1177
          const unsigned long long *op)
1178
0
{
1179
0
   return NC_put_vars(ncid, varid, startp, countp,
1180
0
          stridep, (void *)op, NC_UINT64);
1181
0
}
1182
1183
int
1184
nc_put_vars_string(int ncid, int varid,
1185
       const size_t *startp, const size_t *countp,
1186
       const ptrdiff_t *stridep,
1187
       const char**op)
1188
0
{
1189
0
   return NC_put_vars(ncid, varid, startp, countp, stridep,
1190
0
          (void *)op, NC_STRING);
1191
0
}
1192
1193
/**\} */
1194
1195
/** \ingroup variables
1196
Write a mapped array of values to a variable.
1197
1198
The nc_put_varm() function will only write a variable of an
1199
atomic type; it will not write user defined types. For this
1200
function, the type of the data in memory must match the type
1201
of the variable - no data conversion is done.
1202
1203
@deprecated Use of this family of functions is discouraged,
1204
although it will continue to be supported.
1205
The reason is the complexity of the
1206
algorithm makes its use difficult for users to properly use.
1207
1208
\param ncid NetCDF or group ID, from a previous call to nc_open(),
1209
nc_create(), nc_def_grp(), or associated inquiry functions such as
1210
nc_inq_ncid().
1211
1212
\param varid Variable ID
1213
1214
\param startp Start vector with one element for each dimension to \ref
1215
specify_hyperslab. This array must be same size as variable's number
1216
of dimensions.
1217
1218
\param countp Count vector with one element for each dimension to \ref
1219
specify_hyperslab. This array must be same size as variable's number
1220
of dimensions.
1221
1222
\param stridep Stride vector with one element for each dimension to
1223
\ref specify_hyperslab. This array must be same size as variable's
1224
number of dimensions.
1225
1226
\param imapp Mapping vector with one element for each dimension to
1227
\ref specify_hyperslab.
1228
1229
\param op Pointer where the data will be copied. Memory must be
1230
allocated by the user before this function is called.
1231
1232
\returns ::NC_NOERR No error.
1233
\returns ::NC_ENOTVAR Variable not found.
1234
\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
1235
\returns ::NC_EEDGE Start+count exceeds dimension bound.
1236
\returns ::NC_ERANGE One or more of the values are out of range.
1237
\returns ::NC_EINDEFINE Operation not allowed in define mode.
1238
\returns ::NC_EBADID Bad ncid.
1239
\author Glenn Davis, Russ Rew, Ed Hartnett, Dennis Heimbigner, Ward Fisher
1240
 */
1241
/**@{*/
1242
int
1243
nc_put_varm(int ncid, int varid, const size_t *startp,
1244
       const size_t *countp, const ptrdiff_t *stridep,
1245
       const ptrdiff_t *imapp, const void *op)
1246
0
{
1247
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp, op, NC_NAT);
1248
0
}
1249
1250
int
1251
nc_put_varm_text(int ncid, int varid, const size_t *startp,
1252
     const size_t *countp, const ptrdiff_t *stridep,
1253
     const ptrdiff_t *imapp, const char *op)
1254
0
{
1255
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1256
0
          (void *)op, NC_CHAR);
1257
0
}
1258
1259
int
1260
nc_put_varm_schar(int ncid, int varid,
1261
      const size_t *startp, const size_t *countp,
1262
      const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1263
      const signed char *op)
1264
0
{
1265
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1266
0
          (void *)op, NC_BYTE);
1267
0
}
1268
1269
int
1270
nc_put_varm_uchar(int ncid, int varid,
1271
      const size_t *startp, const size_t *countp,
1272
      const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1273
      const unsigned char *op)
1274
0
{
1275
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1276
0
          (void *)op, T_uchar);
1277
0
}
1278
1279
int
1280
nc_put_varm_short(int ncid, int varid,
1281
      const size_t *startp, const size_t *countp,
1282
      const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1283
      const short *op)
1284
0
{
1285
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1286
0
          (void *)op, NC_SHORT);
1287
0
}
1288
1289
int
1290
nc_put_varm_int(int ncid, int varid,
1291
    const size_t *startp, const size_t *countp,
1292
    const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1293
    const int *op)
1294
0
{
1295
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1296
0
          (void *)op, NC_INT);
1297
0
}
1298
1299
int
1300
nc_put_varm_long(int ncid, int varid,
1301
     const size_t *startp, const size_t *countp,
1302
     const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1303
     const long *op)
1304
0
{
1305
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1306
0
          (void *)op, T_long);
1307
0
}
1308
1309
int
1310
nc_put_varm_float(int ncid, int varid,
1311
      const size_t *startp, const size_t *countp,
1312
      const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1313
      const float *op)
1314
0
{
1315
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1316
0
          (void *)op, T_float);
1317
0
}
1318
1319
int
1320
nc_put_varm_double(int ncid, int varid,
1321
       const size_t *startp, const size_t *countp,
1322
       const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1323
       const double *op)
1324
0
{
1325
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1326
0
          (void *)op, T_double);
1327
0
}
1328
1329
int
1330
nc_put_varm_ubyte(int ncid, int varid,
1331
      const size_t *startp, const size_t *countp,
1332
      const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1333
      const unsigned char *op)
1334
0
{
1335
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1336
0
          (void *)op, T_ubyte);
1337
0
}
1338
1339
int
1340
nc_put_varm_ushort(int ncid, int varid,
1341
       const size_t *startp, const size_t *countp,
1342
       const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1343
       const unsigned short *op)
1344
0
{
1345
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1346
0
          (void *)op, T_ushort);
1347
0
}
1348
1349
int
1350
nc_put_varm_uint(int ncid, int varid,
1351
     const size_t *startp, const size_t *countp,
1352
     const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1353
     const unsigned int *op)
1354
0
{
1355
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1356
0
          (void *)op, T_uint);
1357
0
}
1358
1359
int
1360
nc_put_varm_longlong(int ncid, int varid,
1361
         const size_t *startp, const size_t *countp,
1362
         const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1363
         const long long *op)
1364
0
{
1365
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1366
0
          (void *)op, T_longlong);
1367
0
}
1368
1369
int
1370
nc_put_varm_ulonglong(int ncid, int varid,
1371
          const size_t *startp, const size_t *countp,
1372
          const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1373
          const unsigned long long *op)
1374
0
{
1375
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1376
0
          (void *)op, NC_UINT64);
1377
0
}
1378
1379
int
1380
nc_put_varm_string(int ncid, int varid,
1381
       const size_t *startp, const size_t *countp,
1382
       const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1383
       const char**op)
1384
0
{
1385
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1386
0
          (void *)op, NC_STRING);
1387
0
}
1388
1389
/**\} */
1390
1391
/*! \} */ /*End of named group... */