Coverage Report

Created: 2025-06-09 08:44

/src/gdal/netcdf-c-4.7.4/libdispatch/dvarput.c
Line
Count
Source (jump to first uncovered line)
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
403k
{
87
403k
   NC* ncp;
88
403k
   size_t *my_count = (size_t *)edges;
89
90
403k
   int stat = NC_check_id(ncid, &ncp);
91
403k
   if(stat != NC_NOERR) return stat;
92
93
403k
   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
403k
   stat = ncp->dispatch->put_vara(ncid, varid, start, my_count, value, memtype);
98
403k
   if(edges == NULL) free(my_count);
99
403k
   return stat;
100
403k
}
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.
613
614
\param countp Count vector with one element for each dimension to \ref
615
specify_hyperslab.
616
617
\param op Pointer where the data will be copied. Memory must be
618
allocated by the user before this function is called.
619
620
\returns ::NC_NOERR No error.
621
\returns ::NC_ENOTVAR Variable not found.
622
\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
623
\returns ::NC_EEDGE Start+count exceeds dimension bound.
624
\returns ::NC_ERANGE One or more of the values are out of range.
625
\returns ::NC_EINDEFINE Operation not allowed in define mode.
626
\returns ::NC_EBADID Bad ncid.
627
\author Glenn Davis, Russ Rew, Ed Hartnett, Dennis Heimbigner, Ward Fisher
628
 */
629
/**@{*/
630
int
631
nc_put_vara(int ncid, int varid, const size_t *startp,
632
      const size_t *countp, const void *op)
633
0
{
634
0
   NC* ncp;
635
0
   int stat = NC_check_id(ncid, &ncp);
636
0
   nc_type xtype;
637
0
   if(stat != NC_NOERR) return stat;
638
0
   stat = nc_inq_vartype(ncid, varid, &xtype);
639
0
   if(stat != NC_NOERR) return stat;
640
0
   return NC_put_vara(ncid, varid, startp, countp, op, xtype);
641
0
}
642
643
int
644
nc_put_vara_text(int ncid, int varid, const size_t *startp,
645
     const size_t *countp, const char *op)
646
385k
{
647
385k
   return NC_put_vara(ncid, varid, startp, countp,
648
385k
          (void*)op, NC_CHAR);
649
385k
}
650
651
int
652
nc_put_vara_schar(int ncid, int varid, const size_t *startp,
653
      const size_t *countp, const signed char *op)
654
11.5k
{
655
11.5k
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
656
11.5k
          NC_BYTE);
657
11.5k
}
658
659
int
660
nc_put_vara_uchar(int ncid, int varid, const size_t *startp,
661
      const size_t *countp, const unsigned char *op)
662
0
{
663
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
664
0
          T_uchar);
665
0
}
666
667
int
668
nc_put_vara_short(int ncid, int varid, const size_t *startp,
669
      const size_t *countp, const short *op)
670
0
{
671
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
672
0
          NC_SHORT);
673
0
}
674
675
int
676
nc_put_vara_int(int ncid, int varid, const size_t *startp,
677
    const size_t *countp, const int *op)
678
0
{
679
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
680
0
          NC_INT);
681
0
}
682
683
int
684
nc_put_vara_long(int ncid, int varid, const size_t *startp,
685
     const size_t *countp, const long *op)
686
0
{
687
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
688
0
          T_long);
689
0
}
690
691
int
692
nc_put_vara_float(int ncid, int varid, const size_t *startp,
693
      const size_t *countp, const float *op)
694
0
{
695
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
696
0
          T_float);
697
0
}
698
699
int
700
nc_put_vara_double(int ncid, int varid, const size_t *startp,
701
       const size_t *countp, const double *op)
702
5.81k
{
703
5.81k
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
704
5.81k
          T_double);
705
5.81k
}
706
707
int
708
nc_put_vara_ubyte(int ncid, int varid, const size_t *startp,
709
      const size_t *countp, const unsigned char *op)
710
0
{
711
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
712
0
          T_ubyte);
713
0
}
714
715
int
716
nc_put_vara_ushort(int ncid, int varid, const size_t *startp,
717
       const size_t *countp, const unsigned short *op)
718
0
{
719
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
720
0
          T_ushort);
721
0
}
722
723
int
724
nc_put_vara_uint(int ncid, int varid, const size_t *startp,
725
     const size_t *countp, const unsigned int *op)
726
0
{
727
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
728
0
          T_uint);
729
0
}
730
731
int
732
nc_put_vara_longlong(int ncid, int varid, const size_t *startp,
733
         const size_t *countp, const long long *op)
734
0
{
735
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
736
0
          T_longlong);
737
0
}
738
739
int
740
nc_put_vara_ulonglong(int ncid, int varid, const size_t *startp,
741
          const size_t *countp, const unsigned long long *op)
742
0
{
743
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
744
0
          NC_UINT64);
745
0
}
746
747
int
748
nc_put_vara_string(int ncid, int varid, const size_t *startp,
749
       const size_t *countp, const char* *op)
750
0
{
751
0
   return NC_put_vara(ncid, varid, startp, countp, (void *)op,
752
0
          NC_STRING);
753
0
}
754
755
/**@}*/
756
757
/** \ingroup variables
758
Write one datum.
759
760
\param ncid NetCDF or group ID, from a previous call to nc_open(),
761
nc_create(), nc_def_grp(), or associated inquiry functions such as
762
nc_inq_ncid().
763
764
\param varid Variable ID
765
766
\param indexp Index vector with one element for each dimension.
767
768
\param op Pointer from where the data will be copied.
769
770
\returns ::NC_NOERR No error.
771
\returns ::NC_ENOTVAR Variable not found.
772
\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
773
\returns ::NC_EEDGE Start+count exceeds dimension bound.
774
\returns ::NC_ERANGE One or more of the values are out of range.
775
\returns ::NC_EINDEFINE Operation not allowed in define mode.
776
\returns ::NC_EBADID Bad ncid.
777
\author Glenn Davis, Russ Rew, Ed Hartnett, Dennis Heimbigner, Ward Fisher
778
 */
779
/**@{*/
780
int
781
nc_put_var1(int ncid, int varid, const size_t *indexp, const void *op)
782
0
{
783
0
   return NC_put_var1(ncid, varid, indexp, op, NC_NAT);
784
0
}
785
786
int
787
nc_put_var1_text(int ncid, int varid, const size_t *indexp, const char *op)
788
0
{
789
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_CHAR);
790
0
}
791
792
int
793
nc_put_var1_schar(int ncid, int varid, const size_t *indexp, const signed char *op)
794
0
{
795
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_BYTE);
796
0
}
797
798
int
799
nc_put_var1_uchar(int ncid, int varid, const size_t *indexp, const unsigned char *op)
800
0
{
801
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_UBYTE);
802
0
}
803
804
int
805
nc_put_var1_short(int ncid, int varid, const size_t *indexp, const short *op)
806
0
{
807
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_SHORT);
808
0
}
809
810
int
811
nc_put_var1_int(int ncid, int varid, const size_t *indexp, const int *op)
812
0
{
813
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_INT);
814
0
}
815
816
int
817
nc_put_var1_long(int ncid, int varid, const size_t *indexp, const long *op)
818
0
{
819
0
   return NC_put_var1(ncid, varid, indexp, (void*)op, longtype);
820
0
}
821
822
int
823
nc_put_var1_float(int ncid, int varid, const size_t *indexp, const float *op)
824
0
{
825
0
   return NC_put_var1(ncid, varid, indexp, (void*)op, NC_FLOAT);
826
0
}
827
828
int
829
nc_put_var1_double(int ncid, int varid, const size_t *indexp, const double *op)
830
0
{
831
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_DOUBLE);
832
0
}
833
834
int
835
nc_put_var1_ubyte(int ncid, int varid, const size_t *indexp, const unsigned char *op)
836
0
{
837
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_UBYTE);
838
0
}
839
840
int
841
nc_put_var1_ushort(int ncid, int varid, const size_t *indexp, const unsigned short *op)
842
0
{
843
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_USHORT);
844
0
}
845
846
int
847
nc_put_var1_uint(int ncid, int varid, const size_t *indexp, const unsigned int *op)
848
0
{
849
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_UINT);
850
0
}
851
852
int
853
nc_put_var1_longlong(int ncid, int varid, const size_t *indexp, const long long *op)
854
0
{
855
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_INT64);
856
0
}
857
858
int
859
nc_put_var1_ulonglong(int ncid, int varid, const size_t *indexp, const unsigned long long *op)
860
0
{
861
0
   return NC_put_var1(ncid, varid, indexp, (void *)op, NC_UINT64);
862
0
}
863
864
int
865
nc_put_var1_string(int ncid, int varid, const size_t *indexp, const char* *op)
866
0
{
867
0
   return NC_put_var1(ncid, varid, indexp, (void*)op, NC_STRING);
868
0
}
869
870
/**@}*/
871
872
/** \ingroup variables
873
Write an entire variable with one call.
874
875
The nc_put_var_ type family of functions write all the values of a
876
variable into a netCDF variable of an open netCDF dataset. This is the
877
simplest interface to use for writing a value in a scalar variable or
878
whenever all the values of a multidimensional variable can all be
879
written at once. The values to be written are associated with the
880
netCDF variable by assuming that the last dimension of the netCDF
881
variable varies fastest in the C interface. The values are converted
882
to the external data type of the variable, if necessary.
883
884
Take care when using this function with record variables (variables
885
that use the ::NC_UNLIMITED dimension). If you try to write all the
886
values of a record variable into a netCDF file that has no record data
887
yet (hence has 0 records), nothing will be written. Similarly, if you
888
try to write all the values of a record variable but there are more
889
records in the file than you assume, more in-memory data will be
890
accessed than you supply, which may result in a segmentation
891
violation. To avoid such problems, it is better to use the nc_put_vara
892
interfaces for variables that use the ::NC_UNLIMITED dimension.
893
894
The functions for types ubyte, ushort, uint, longlong, ulonglong, and
895
string are only available for netCDF-4/HDF5 files.
896
897
The nc_put_var() function will write a variable of any type, including
898
user defined type. For this function, the type of the data in memory
899
must match the type of the variable - no data conversion is done.
900
901
\param ncid NetCDF or group ID, from a previous call to nc_open(),
902
nc_create(), nc_def_grp(), or associated inquiry functions such as
903
nc_inq_ncid().
904
905
\param varid Variable ID
906
907
\param op Pointer from where the data will be copied.
908
909
\returns ::NC_NOERR No error.
910
\returns ::NC_ENOTVAR Variable not found.
911
\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
912
\returns ::NC_EEDGE Start+count exceeds dimension bound.
913
\returns ::NC_ERANGE One or more of the values are out of range.
914
\returns ::NC_EINDEFINE Operation not allowed in define mode.
915
\returns ::NC_EBADID Bad ncid.
916
\author Glenn Davis, Russ Rew, Ed Hartnett, Dennis Heimbigner, Ward Fisher
917
 */
918
/**@{*/
919
int
920
nc_put_var(int ncid, int varid, const void *op)
921
0
{
922
0
   return NC_put_var(ncid, varid, op, NC_NAT);
923
0
}
924
925
int
926
nc_put_var_text(int ncid, int varid, const char *op)
927
0
{
928
0
   return NC_put_var(ncid,varid,(void*)op,NC_CHAR);
929
0
}
930
931
int
932
nc_put_var_schar(int ncid, int varid, const signed char *op)
933
0
{
934
0
   return NC_put_var(ncid,varid,(void*)op,NC_BYTE);
935
0
}
936
937
int
938
nc_put_var_uchar(int ncid, int varid, const unsigned char *op)
939
0
{
940
0
   return NC_put_var(ncid,varid,(void*)op,T_uchar);
941
0
}
942
943
int
944
nc_put_var_short(int ncid, int varid, const short *op)
945
0
{
946
0
   return NC_put_var(ncid,varid,(void*)op,NC_SHORT);
947
0
}
948
949
int
950
nc_put_var_int(int ncid, int varid, const int *op)
951
0
{
952
0
   return NC_put_var(ncid,varid,(void*)op,NC_INT);
953
0
}
954
955
int
956
nc_put_var_long(int ncid, int varid, const long *op)
957
0
{
958
0
   return NC_put_var(ncid,varid,(void*)op,T_long);
959
0
}
960
961
int
962
nc_put_var_float(int ncid, int varid, const float *op)
963
0
{
964
0
   return NC_put_var(ncid,varid,(void*)op,T_float);
965
0
}
966
967
int
968
nc_put_var_double(int ncid, int varid, const double *op)
969
0
{
970
0
   return NC_put_var(ncid,varid,(void*)op,T_double);
971
0
}
972
973
int
974
nc_put_var_ubyte(int ncid, int varid, const unsigned char *op)
975
0
{
976
0
   return NC_put_var(ncid,varid,(void*)op,T_ubyte);
977
0
}
978
979
int
980
nc_put_var_ushort(int ncid, int varid, const unsigned short *op)
981
0
{
982
0
   return NC_put_var(ncid,varid,(void*)op,T_ushort);
983
0
}
984
985
int
986
nc_put_var_uint(int ncid, int varid, const unsigned int *op)
987
0
{
988
0
   return NC_put_var(ncid,varid,(void*)op,T_uint);
989
0
}
990
991
int
992
nc_put_var_longlong(int ncid, int varid, const long long *op)
993
0
{
994
0
   return NC_put_var(ncid,varid,(void*)op,T_longlong);
995
0
}
996
997
int
998
nc_put_var_ulonglong(int ncid, int varid, const unsigned long long *op)
999
0
{
1000
0
   return NC_put_var(ncid,varid,(void*)op,NC_UINT64);
1001
0
}
1002
1003
int
1004
nc_put_var_string(int ncid, int varid, const char* *op)
1005
0
{
1006
0
   return NC_put_var(ncid,varid,(void*)op,NC_STRING);
1007
0
}
1008
1009
/**\} */
1010
1011
/** \ingroup variables
1012
Write a strided array of values to a variable.
1013
1014
\param ncid NetCDF or group ID, from a previous call to nc_open(),
1015
nc_create(), nc_def_grp(), or associated inquiry functions such as
1016
nc_inq_ncid().
1017
1018
\param varid Variable ID
1019
1020
\param startp Start vector with one element for each dimension to \ref
1021
specify_hyperslab.
1022
1023
\param countp Count vector with one element for each dimension to \ref
1024
specify_hyperslab.
1025
1026
\param stridep Stride vector with one element for each dimension to
1027
\ref specify_hyperslab.
1028
1029
\param op Pointer where the data will be copied. Memory must be
1030
allocated by the user before this function is called.
1031
1032
\returns ::NC_NOERR No error.
1033
\returns ::NC_ENOTVAR Variable not found.
1034
\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
1035
\returns ::NC_EEDGE Start+count exceeds dimension bound.
1036
\returns ::NC_ERANGE One or more of the values are out of range.
1037
\returns ::NC_EINDEFINE Operation not allowed in define mode.
1038
\returns ::NC_EBADID Bad ncid.
1039
\author Glenn Davis, Russ Rew, Ed Hartnett, Dennis Heimbigner, Ward Fisher
1040
 */
1041
/**@{*/
1042
int
1043
nc_put_vars(int ncid, int varid, const size_t *startp,
1044
       const size_t *countp, const ptrdiff_t *stridep,
1045
       const void *op)
1046
0
{
1047
0
   return NC_put_vars(ncid, varid, startp, countp, stridep, op, NC_NAT);
1048
0
}
1049
1050
int
1051
nc_put_vars_text(int ncid, int varid, const size_t *startp,
1052
     const size_t *countp, const ptrdiff_t *stridep,
1053
     const char *op)
1054
0
{
1055
0
   return NC_put_vars(ncid, varid, startp, countp,
1056
0
          stridep,(void*)op,NC_CHAR);
1057
0
}
1058
1059
int
1060
nc_put_vars_schar(int ncid, int varid, const size_t *startp,
1061
      const size_t *countp, const ptrdiff_t *stridep,
1062
      const signed char *op)
1063
0
{
1064
0
   return NC_put_vars(ncid, varid, startp, countp,
1065
0
          stridep,(void*)op,NC_BYTE);
1066
0
}
1067
1068
int
1069
nc_put_vars_uchar(int ncid, int varid,
1070
      const size_t *startp, const size_t *countp,
1071
      const ptrdiff_t *stridep,
1072
      const unsigned char *op)
1073
0
{
1074
0
   return NC_put_vars(ncid, varid, startp, countp,
1075
0
          stridep, (void *)op, T_uchar);
1076
0
}
1077
1078
int
1079
nc_put_vars_short(int ncid, int varid,
1080
      const size_t *startp, const size_t *countp,
1081
      const ptrdiff_t *stridep,
1082
      const short *op)
1083
0
{
1084
0
   return NC_put_vars(ncid, varid, startp, countp,
1085
0
          stridep, (void *)op, NC_SHORT);
1086
0
}
1087
1088
int
1089
nc_put_vars_int(int ncid, int varid,
1090
    const size_t *startp, const size_t *countp,
1091
    const ptrdiff_t *stridep,
1092
    const int *op)
1093
0
{
1094
0
   return NC_put_vars(ncid, varid, startp, countp,
1095
0
          stridep, (void *)op, NC_INT);
1096
0
}
1097
1098
int
1099
nc_put_vars_long(int ncid, int varid,
1100
     const size_t *startp, const size_t *countp,
1101
     const ptrdiff_t *stridep,
1102
     const long *op)
1103
0
{
1104
0
   return NC_put_vars(ncid, varid, startp, countp,
1105
0
          stridep, (void *)op, T_long);
1106
0
}
1107
1108
int
1109
nc_put_vars_float(int ncid, int varid,
1110
      const size_t *startp, const size_t *countp,
1111
      const ptrdiff_t *stridep,
1112
      const float *op)
1113
0
{
1114
0
   return NC_put_vars(ncid, varid, startp, countp,
1115
0
          stridep, (void *)op, T_float);
1116
0
}
1117
1118
int
1119
nc_put_vars_double(int ncid, int varid,
1120
       const size_t *startp, const size_t *countp,
1121
       const ptrdiff_t *stridep,
1122
       const double *op)
1123
0
{
1124
0
   return NC_put_vars(ncid, varid, startp, countp,
1125
0
          stridep, (void *)op, T_double);
1126
0
}
1127
1128
int
1129
nc_put_vars_ubyte(int ncid, int varid,
1130
      const size_t *startp, const size_t *countp,
1131
      const ptrdiff_t *stridep,
1132
      const unsigned char *op)
1133
0
{
1134
0
   return NC_put_vars(ncid, varid, startp, countp,
1135
0
          stridep, (void *)op, T_ubyte);
1136
0
}
1137
1138
int
1139
nc_put_vars_ushort(int ncid, int varid,
1140
       const size_t *startp, const size_t *countp,
1141
       const ptrdiff_t *stridep,
1142
       const unsigned short *op)
1143
0
{
1144
0
   return NC_put_vars(ncid, varid, startp, countp,
1145
0
          stridep, (void *)op, T_ushort);
1146
0
}
1147
1148
int
1149
nc_put_vars_uint(int ncid, int varid,
1150
     const size_t *startp, const size_t *countp,
1151
     const ptrdiff_t *stridep,
1152
     const unsigned int *op)
1153
0
{
1154
0
   return NC_put_vars(ncid, varid, startp, countp,
1155
0
          stridep, (void *)op, T_uint);
1156
0
}
1157
1158
int
1159
nc_put_vars_longlong(int ncid, int varid,
1160
         const size_t *startp, const size_t *countp,
1161
         const ptrdiff_t *stridep,
1162
         const long long *op)
1163
0
{
1164
0
   return NC_put_vars(ncid, varid, startp, countp,
1165
0
          stridep, (void *)op, T_longlong);
1166
0
}
1167
1168
int
1169
nc_put_vars_ulonglong(int ncid, int varid,
1170
          const size_t *startp, const size_t *countp,
1171
          const ptrdiff_t *stridep,
1172
          const unsigned long long *op)
1173
0
{
1174
0
   return NC_put_vars(ncid, varid, startp, countp,
1175
0
          stridep, (void *)op, NC_UINT64);
1176
0
}
1177
1178
int
1179
nc_put_vars_string(int ncid, int varid,
1180
       const size_t *startp, const size_t *countp,
1181
       const ptrdiff_t *stridep,
1182
       const char**op)
1183
0
{
1184
0
   return NC_put_vars(ncid, varid, startp, countp, stridep,
1185
0
          (void *)op, NC_STRING);
1186
0
}
1187
1188
/**\} */
1189
1190
/** \ingroup variables
1191
Write a mapped array of values to a variable.
1192
1193
The nc_put_varm() function will only write a variable of an
1194
atomic type; it will not write user defined types. For this
1195
function, the type of the data in memory must match the type
1196
of the variable - no data conversion is done.
1197
1198
@deprecated Use of this family of functions is discouraged,
1199
although it will continue to be supported.
1200
The reason is the complexity of the
1201
algorithm makes its use difficult for users to properly use.
1202
1203
\param ncid NetCDF or group ID, from a previous call to nc_open(),
1204
nc_create(), nc_def_grp(), or associated inquiry functions such as
1205
nc_inq_ncid().
1206
1207
\param varid Variable ID
1208
1209
\param startp Start vector with one element for each dimension to \ref
1210
specify_hyperslab.
1211
1212
\param countp Count vector with one element for each dimension to \ref
1213
specify_hyperslab.
1214
1215
\param stridep Stride vector with one element for each dimension to
1216
\ref specify_hyperslab.
1217
1218
\param imapp Mapping vector with one element for each dimension to
1219
\ref specify_hyperslab.
1220
1221
\param op Pointer where the data will be copied. Memory must be
1222
allocated by the user before this function is called.
1223
1224
\returns ::NC_NOERR No error.
1225
\returns ::NC_ENOTVAR Variable not found.
1226
\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
1227
\returns ::NC_EEDGE Start+count exceeds dimension bound.
1228
\returns ::NC_ERANGE One or more of the values are out of range.
1229
\returns ::NC_EINDEFINE Operation not allowed in define mode.
1230
\returns ::NC_EBADID Bad ncid.
1231
\author Glenn Davis, Russ Rew, Ed Hartnett, Dennis Heimbigner, Ward Fisher
1232
 */
1233
/**@{*/
1234
int
1235
nc_put_varm(int ncid, int varid, const size_t *startp,
1236
       const size_t *countp, const ptrdiff_t *stridep,
1237
       const ptrdiff_t *imapp, const void *op)
1238
0
{
1239
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp, op, NC_NAT);
1240
0
}
1241
1242
int
1243
nc_put_varm_text(int ncid, int varid, const size_t *startp,
1244
     const size_t *countp, const ptrdiff_t *stridep,
1245
     const ptrdiff_t *imapp, const char *op)
1246
0
{
1247
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1248
0
          (void *)op, NC_CHAR);
1249
0
}
1250
1251
int
1252
nc_put_varm_schar(int ncid, int varid,
1253
      const size_t *startp, const size_t *countp,
1254
      const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1255
      const signed char *op)
1256
0
{
1257
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1258
0
          (void *)op, NC_BYTE);
1259
0
}
1260
1261
int
1262
nc_put_varm_uchar(int ncid, int varid,
1263
      const size_t *startp, const size_t *countp,
1264
      const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1265
      const unsigned char *op)
1266
0
{
1267
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1268
0
          (void *)op, T_uchar);
1269
0
}
1270
1271
int
1272
nc_put_varm_short(int ncid, int varid,
1273
      const size_t *startp, const size_t *countp,
1274
      const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1275
      const short *op)
1276
0
{
1277
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1278
0
          (void *)op, NC_SHORT);
1279
0
}
1280
1281
int
1282
nc_put_varm_int(int ncid, int varid,
1283
    const size_t *startp, const size_t *countp,
1284
    const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1285
    const int *op)
1286
0
{
1287
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1288
0
          (void *)op, NC_INT);
1289
0
}
1290
1291
int
1292
nc_put_varm_long(int ncid, int varid,
1293
     const size_t *startp, const size_t *countp,
1294
     const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1295
     const long *op)
1296
0
{
1297
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1298
0
          (void *)op, T_long);
1299
0
}
1300
1301
int
1302
nc_put_varm_float(int ncid, int varid,
1303
      const size_t *startp, const size_t *countp,
1304
      const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1305
      const float *op)
1306
0
{
1307
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1308
0
          (void *)op, T_float);
1309
0
}
1310
1311
int
1312
nc_put_varm_double(int ncid, int varid,
1313
       const size_t *startp, const size_t *countp,
1314
       const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1315
       const double *op)
1316
0
{
1317
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1318
0
          (void *)op, T_double);
1319
0
}
1320
1321
int
1322
nc_put_varm_ubyte(int ncid, int varid,
1323
      const size_t *startp, const size_t *countp,
1324
      const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1325
      const unsigned char *op)
1326
0
{
1327
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1328
0
          (void *)op, T_ubyte);
1329
0
}
1330
1331
int
1332
nc_put_varm_ushort(int ncid, int varid,
1333
       const size_t *startp, const size_t *countp,
1334
       const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1335
       const unsigned short *op)
1336
0
{
1337
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1338
0
          (void *)op, T_ushort);
1339
0
}
1340
1341
int
1342
nc_put_varm_uint(int ncid, int varid,
1343
     const size_t *startp, const size_t *countp,
1344
     const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1345
     const unsigned int *op)
1346
0
{
1347
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1348
0
          (void *)op, T_uint);
1349
0
}
1350
1351
int
1352
nc_put_varm_longlong(int ncid, int varid,
1353
         const size_t *startp, const size_t *countp,
1354
         const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1355
         const long long *op)
1356
0
{
1357
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1358
0
          (void *)op, T_longlong);
1359
0
}
1360
1361
int
1362
nc_put_varm_ulonglong(int ncid, int varid,
1363
          const size_t *startp, const size_t *countp,
1364
          const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1365
          const unsigned long long *op)
1366
0
{
1367
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1368
0
          (void *)op, NC_UINT64);
1369
0
}
1370
1371
int
1372
nc_put_varm_string(int ncid, int varid,
1373
       const size_t *startp, const size_t *countp,
1374
       const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1375
       const char**op)
1376
0
{
1377
0
   return NC_put_varm(ncid, varid, startp, countp, stridep, imapp,
1378
0
          (void *)op, NC_STRING);
1379
0
}
1380
1381
/**\} */
1382
1383
/*! \} */ /*End of named group... */