NetCDF  4.3.3.1
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
dvarget.c
Go to the documentation of this file.
1 
9 #include "ncdispatch.h"
10 
11 #undef VARS_USES_VARM
12 #ifndef VARS_USES_VARM
13 
17 struct GETodometer {
18  int rank;
19  size_t index[NC_MAX_VAR_DIMS];
20  size_t start[NC_MAX_VAR_DIMS];
21  size_t edges[NC_MAX_VAR_DIMS];
22  ptrdiff_t stride[NC_MAX_VAR_DIMS];
23  size_t stop[NC_MAX_VAR_DIMS];
24 };
25 
26 
30 static void
31 odom_init(struct GETodometer* odom,
32  int rank,
33  const size_t* start, const size_t* edges, const ptrdiff_t* stride)
34 {
35  int i;
36  memset(odom,0,sizeof(struct GETodometer));
37  odom->rank = rank;
38  assert(odom->rank <= NC_MAX_VAR_DIMS);
39  for(i=0;i<odom->rank;i++) {
40  odom->start[i] = (start != NULL ? start[i] : 0);
41  odom->edges[i] = (edges != NULL ? edges[i] : 1);
42  odom->stride[i] = (stride != NULL ? stride[i] : 1);
43  odom->stop[i] = odom->start[i] + (odom->edges[i]*((size_t)odom->stride[i]));
44  odom->index[i] = odom->start[i];
45  }
46 }
47 
51 static int
52 odom_more(struct GETodometer* odom)
53 {
54  return (odom->index[0] < odom->stop[0]);
55 }
56 
60 static int
61 odom_next(struct GETodometer* odom)
62 {
63  int i;
64  if(odom->rank == 0) return 0;
65  for(i=odom->rank-1;i>=0;i--) {
66  odom->index[i] += (size_t)odom->stride[i];
67  if(odom->index[i] < odom->stop[i]) break;
68  if(i == 0) return 0; /* leave the 0th entry if it overflows*/
69  odom->index[i] = odom->start[i]; /* reset this position*/
70  }
71  return 1;
72 }
73 #endif
74 
79 int
80 NC_get_vara(int ncid, int varid,
81  const size_t *start, const size_t *edges,
82  void *value, nc_type memtype)
83 {
84  NC* ncp;
85  int stat = NC_check_id(ncid, &ncp);
86  if(stat != NC_NOERR) return stat;
87 #ifdef USE_NETCDF4
88  if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
89 #endif
90 
91  if(edges == NULL) {
92  size_t shape[NC_MAX_VAR_DIMS];
93  int ndims;
94  stat = nc_inq_varndims(ncid, varid, &ndims);
95  if(stat != NC_NOERR) return stat;
96  stat = NC_getshape(ncid,varid,ndims,shape);
97  if(stat != NC_NOERR) return stat;
98  stat = ncp->dispatch->get_vara(ncid,varid,start,shape,value,memtype);
99  } else
100  stat = ncp->dispatch->get_vara(ncid,varid,start,edges,value,memtype);
101  return stat;
102 }
103 
107 static int
108 NC_get_var(int ncid, int varid, void *value, nc_type memtype)
109 {
110  int ndims;
111  size_t shape[NC_MAX_VAR_DIMS];
112  int stat = nc_inq_varndims(ncid,varid, &ndims);
113  if(stat) return stat;
114  stat = NC_getshape(ncid,varid, ndims, shape);
115  if(stat) return stat;
116  return NC_get_vara(ncid, varid, NC_coord_zero, shape, value, memtype);
117 }
118 
123 int
124 NCDEFAULT_get_vars(int ncid, int varid, const size_t * start,
125  const size_t * edges, const ptrdiff_t * stride,
126  void *value0, nc_type memtype)
127 {
128 #ifdef VARS_USES_VARM
129  NC* ncp;
130  int stat = NC_check_id(ncid, &ncp);
131 
132  if(stat != NC_NOERR) return stat;
133  return ncp->dispatch->get_varm(ncid,varid,start,edges,stride,NULL,value0,memtype);
134 #else
135  /* Rebuilt get_vars code to simplify and avoid use of get_varm */
136 
137  int status = NC_NOERR;
138  int i,simplestride,isrecvar;
139  int rank;
140  struct GETodometer odom;
141  nc_type vartype = NC_NAT;
142  NC* ncp;
143  int memtypelen;
144  size_t vartypelen;
145  char* value = (char*)value0;
146  size_t numrecs;
147  size_t varshape[NC_MAX_VAR_DIMS];
148  size_t mystart[NC_MAX_VAR_DIMS];
149  size_t myedges[NC_MAX_VAR_DIMS];
150  ptrdiff_t mystride[NC_MAX_VAR_DIMS];
151  char *memptr = NULL;
152 
153  status = NC_check_id (ncid, &ncp);
154  if(status != NC_NOERR) return status;
155 
156  status = nc_inq_vartype(ncid, varid, &vartype);
157  if(status != NC_NOERR) return status;
158 
159  if(memtype == NC_NAT) memtype = vartype;
160 
161  /* compute the variable type size */
162  status = nc_inq_type(ncid,vartype,NULL,&vartypelen);
163  if(status != NC_NOERR) return status;
164 
165  if(memtype > NC_MAX_ATOMIC_TYPE)
166  memtypelen = (int)vartypelen;
167  else
168  memtypelen = nctypelen(memtype);
169 
170  /* Check gross internal/external type compatibility */
171  if(vartype != memtype) {
172  /* If !atomic, the two types must be the same */
173  if(vartype > NC_MAX_ATOMIC_TYPE
174  || memtype > NC_MAX_ATOMIC_TYPE)
175  return NC_EBADTYPE;
176  /* ok, the types differ but both are atomic */
177  if(memtype == NC_CHAR || vartype == NC_CHAR)
178  return NC_ECHAR;
179  }
180 
181  /* Get the variable rank */
182  status = nc_inq_varndims(ncid, varid, &rank);
183  if(status != NC_NOERR) return status;
184 
185  /* Get variable dimension sizes */
186  isrecvar = NC_is_recvar(ncid,varid,&numrecs);
187  NC_getshape(ncid,varid,rank,varshape);
188 
189  /* Optimize out using various checks */
190  if (rank == 0) {
191  /*
192  * The variable is a scalar; consequently,
193  * there s only one thing to get and only one place to put it.
194  * (Why was I called?)
195  */
196  size_t edge1[1] = {1};
197  return NC_get_vara(ncid, varid, start, edge1, value, memtype);
198  }
199 
200  /* Do various checks and fixups on start/edges/stride */
201  simplestride = 1; /* assume so */
202  for(i=0;i<rank;i++) {
203  size_t dimlen;
204  mystart[i] = (start == NULL ? 0 : start[i]);
205  if(edges == NULL) {
206  if(i == 0 && isrecvar)
207  myedges[i] = numrecs - start[i];
208  else
209  myedges[i] = varshape[i] - mystart[i];
210  } else
211  myedges[i] = edges[i];
212  if(myedges[i] == 0)
213  return NC_NOERR; /* cannot read anything */
214  mystride[i] = (stride == NULL ? 1 : stride[i]);
215  if(mystride[i] <= 0
216  /* cast needed for braindead systems with signed size_t */
217  || ((unsigned long) mystride[i] >= X_INT_MAX))
218  return NC_ESTRIDE;
219  if(mystride[i] != 1) simplestride = 0;
220  /* illegal value checks */
221  dimlen = (i == 0 && isrecvar ? numrecs : varshape[i]);
222  /* mystart is unsigned, never < 0 */
223  if(mystart[i] >= dimlen)
224  return NC_EINVALCOORDS;
225  /* myedges is unsigned, never < 0 */
226  if(mystart[i] + myedges[i] > dimlen)
227  return NC_EEDGE;
228  }
229  if(simplestride) {
230  return NC_get_vara(ncid, varid, mystart, myedges, value, memtype);
231  }
232 
233  /* memptr indicates where to store the next value */
234  memptr = value;
235 
236  odom_init(&odom,rank,mystart,myedges,mystride);
237 
238  /* walk the odometer to extract values */
239  while(odom_more(&odom)) {
240  int localstatus = NC_NOERR;
241  /* Read a single value */
242  localstatus = NC_get_vara(ncid,varid,odom.index,nc_sizevector1,memptr,memtype);
243  /* So it turns out that when get_varm is used, all errors are
244  delayed and ERANGE will be overwritten by more serious errors.
245  */
246  if(localstatus != NC_NOERR) {
247  if(status == NC_NOERR || localstatus != NC_ERANGE)
248  status = localstatus;
249  }
250  memptr += memtypelen;
251  odom_next(&odom);
252  }
253  return status;
254 #endif
255 }
256 
260 static int
261 NC_get_var1(int ncid, int varid, const size_t *coord, void* value,
262  nc_type memtype)
263 {
264  return NC_get_vara(ncid, varid, coord, NC_coord_one, value, memtype);
265 }
266 
270 int
271 NCDEFAULT_get_varm(int ncid, int varid, const size_t *start,
272  const size_t *edges, const ptrdiff_t *stride,
273  const ptrdiff_t *imapp, void *value0, nc_type memtype)
274 {
275  int status = NC_NOERR;
276  nc_type vartype = NC_NAT;
277  int varndims,maxidim;
278  NC* ncp;
279  int memtypelen;
280  ptrdiff_t cvtmap[NC_MAX_VAR_DIMS];
281  char* value = (char*)value0;
282 
283  status = NC_check_id (ncid, &ncp);
284  if(status != NC_NOERR) return status;
285 
286 /*
287  if(NC_indef(ncp)) return NC_EINDEFINE;
288 */
289 
290  status = nc_inq_vartype(ncid, varid, &vartype);
291  if(status != NC_NOERR) return status;
292  /* Check that this is an atomic type */
293  if(vartype > NC_MAX_ATOMIC_TYPE)
294  return NC_EMAPTYPE;
295 
296  status = nc_inq_varndims(ncid, varid, &varndims);
297  if(status != NC_NOERR) return status;
298 
299  if(memtype == NC_NAT) {
300  if(imapp != NULL && varndims != 0) {
301  /*
302  * convert map units from bytes to units of sizeof(type)
303  */
304  size_t ii;
305  const ptrdiff_t szof = (ptrdiff_t) nctypelen(vartype);
306  for(ii = 0; ii < varndims; ii++) {
307  if(imapp[ii] % szof != 0) {
308  /*free(cvtmap);*/
309  return NC_EINVAL;
310  }
311  cvtmap[ii] = imapp[ii] / szof;
312  }
313  imapp = cvtmap;
314  }
315  memtype = vartype;
316  }
317 
318  if(memtype == NC_CHAR && vartype != NC_CHAR)
319  return NC_ECHAR;
320  else if(memtype != NC_CHAR && vartype == NC_CHAR)
321  return NC_ECHAR;
322 
323  memtypelen = nctypelen(memtype);
324 
325  maxidim = (int) varndims - 1;
326 
327  if (maxidim < 0)
328  {
329  /*
330  * The variable is a scalar; consequently,
331  * there s only one thing to get and only one place to put it.
332  * (Why was I called?)
333  */
334  size_t edge1[1] = {1};
335  return NC_get_vara(ncid, varid, start, edge1, value, memtype);
336  }
337 
338  /*
339  * else
340  * The variable is an array.
341  */
342  {
343  int idim;
344  size_t *mystart = NULL;
345  size_t *myedges;
346  size_t *iocount; /* count vector */
347  size_t *stop; /* stop indexes */
348  size_t *length; /* edge lengths in bytes */
349  ptrdiff_t *mystride;
350  ptrdiff_t *mymap;
351  size_t varshape[NC_MAX_VAR_DIMS];
352  int isrecvar;
353  size_t numrecs;
354 
355  /* Compute some dimension related values */
356  isrecvar = NC_is_recvar(ncid,varid,&numrecs);
357  NC_getshape(ncid,varid,varndims,varshape);
358 
359  /*
360  * Verify stride argument; also see if stride is all ones
361  */
362  if(stride != NULL) {
363  int stride1 = 1;
364  for (idim = 0; idim <= maxidim; ++idim)
365  {
366  if (stride[idim] == 0
367  /* cast needed for braindead systems with signed size_t */
368  || ((unsigned long) stride[idim] >= X_INT_MAX))
369  {
370  return NC_ESTRIDE;
371  }
372  if(stride[idim] != 1) stride1 = 0;
373  }
374  /* If stride1 is true, and there is no imap
375  then call get_vara directly.
376  */
377  if(stride1 && imapp == NULL) {
378  return NC_get_vara(ncid, varid, start, edges, value, memtype);
379  }
380  }
381 
382  /* assert(sizeof(ptrdiff_t) >= sizeof(size_t)); */
383  /* Allocate space for mystart,mystride,mymap etc.all at once */
384  mystart = (size_t *)calloc((size_t)(varndims * 7), sizeof(ptrdiff_t));
385  if(mystart == NULL) return NC_ENOMEM;
386  myedges = mystart + varndims;
387  iocount = myedges + varndims;
388  stop = iocount + varndims;
389  length = stop + varndims;
390  mystride = (ptrdiff_t *)(length + varndims);
391  mymap = mystride + varndims;
392 
393  /*
394  * Initialize I/O parameters.
395  */
396  for (idim = maxidim; idim >= 0; --idim)
397  {
398  mystart[idim] = start != NULL
399  ? start[idim]
400  : 0;
401 
402  if (edges != NULL && edges[idim] == 0)
403  {
404  status = NC_NOERR; /* read/write no data */
405  goto done;
406  }
407 
408 #ifdef COMPLEX
409  myedges[idim] = edges != NULL
410  ? edges[idim]
411  : idim == 0 && isrecvar
412  ? numrecs - mystart[idim]
413  : varshape[idim] - mystart[idim];
414 #else
415  if(edges != NULL)
416  myedges[idim] = edges[idim];
417  else if (idim == 0 && isrecvar)
418  myedges[idim] = numrecs - mystart[idim];
419  else
420  myedges[idim] = varshape[idim] - mystart[idim];
421 #endif
422 
423  mystride[idim] = stride != NULL
424  ? stride[idim]
425  : 1;
426 
427  /* Remember: imapp is byte oriented, not index oriented */
428 #ifdef COMPLEX
429  mymap[idim] = (imapp != NULL
430  ? imapp[idim]
431  : (idim == maxidim ? 1
432  : mymap[idim + 1] * (ptrdiff_t) myedges[idim + 1]));
433 #else
434  if(imapp != NULL)
435  mymap[idim] = imapp[idim];
436  else if (idim == maxidim)
437  mymap[idim] = 1;
438  else
439  mymap[idim] =
440  mymap[idim + 1] * (ptrdiff_t) myedges[idim + 1];
441 #endif
442  iocount[idim] = 1;
443  length[idim] = ((size_t)mymap[idim]) * myedges[idim];
444  stop[idim] = (mystart[idim] + myedges[idim] * (size_t)mystride[idim]);
445  }
446 
447  /*
448  * Check start, edges
449  */
450  for (idim = maxidim; idim >= 0; --idim)
451  {
452  size_t dimlen =
453  idim == 0 && isrecvar
454  ? numrecs
455  : varshape[idim];
456  if (mystart[idim] >= dimlen)
457  {
458  status = NC_EINVALCOORDS;
459  goto done;
460  }
461 
462  if (mystart[idim] + myedges[idim] > dimlen)
463  {
464  status = NC_EEDGE;
465  goto done;
466  }
467 
468  }
469 
470 
471  /* Lower body */
472  /*
473  * As an optimization, adjust I/O parameters when the fastest
474  * dimension has unity stride both externally and internally.
475  * In this case, the user could have called a simpler routine
476  * (i.e. ncvar$1()
477  */
478  if (mystride[maxidim] == 1
479  && mymap[maxidim] == 1)
480  {
481  iocount[maxidim] = myedges[maxidim];
482  mystride[maxidim] = (ptrdiff_t) myedges[maxidim];
483  mymap[maxidim] = (ptrdiff_t) length[maxidim];
484  }
485 
486  /*
487  * Perform I/O. Exit when done.
488  */
489  for (;;)
490  {
491  /* TODO: */
492  int lstatus = NC_get_vara(ncid, varid, mystart, iocount,
493  value, memtype);
494  if (lstatus != NC_NOERR) {
495  if(status == NC_NOERR || lstatus != NC_ERANGE)
496  status = lstatus;
497  }
498  /*
499  * The following code permutes through the variable s
500  * external start-index space and it s internal address
501  * space. At the UPC, this algorithm is commonly
502  * called "odometer code".
503  */
504  idim = maxidim;
505  carry:
506  value += (((int)mymap[idim]) * memtypelen);
507  mystart[idim] += (size_t)mystride[idim];
508  if (mystart[idim] == stop[idim])
509  {
510  size_t l = (length[idim] * (size_t)memtypelen);
511  value -= l;
512  mystart[idim] = start[idim];
513  if (--idim < 0)
514  break; /* normal return */
515  goto carry;
516  }
517  } /* I/O loop */
518  done:
519  free(mystart);
520  } /* variable is array */
521  return status;
522 }
523 
527 static int
528 NC_get_vars(int ncid, int varid, const size_t *start,
529  const size_t *edges, const ptrdiff_t *stride, void *value,
530  nc_type memtype)
531 {
532  NC* ncp;
533  int stat = NC_check_id(ncid, &ncp);
534 
535  if(stat != NC_NOERR) return stat;
536 #ifdef USE_NETCDF4
537  if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
538 #endif
539  return ncp->dispatch->get_vars(ncid,varid,start,edges,stride,value,memtype);
540 }
541 
546 static int
547 NC_get_varm(int ncid, int varid, const size_t *start,
548  const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t* map,
549  void *value, nc_type memtype)
550 {
551  NC* ncp;
552  int stat = NC_check_id(ncid, &ncp);
553 
554  if(stat != NC_NOERR) return stat;
555 #ifdef USE_NETCDF4
556  if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
557 #endif
558  return ncp->dispatch->get_varm(ncid,varid,start,edges,stride,map,value,memtype);
559 }
560  /* All these functions are part of this named group... */
565 
640 int
641 nc_get_vara(int ncid, int varid, const size_t *startp,
642  const size_t *countp, void *ip)
643 {
644  NC* ncp = NULL;
645  nc_type xtype = NC_NAT;
646  int stat = NC_check_id(ncid, &ncp);
647  if(stat != NC_NOERR) return stat;
648  stat = nc_inq_vartype(ncid, varid, &xtype);
649  if(stat != NC_NOERR) return stat;
650  return NC_get_vara(ncid, varid, startp, countp, ip, xtype);
651 }
652 
653 int
654 nc_get_vara_text(int ncid, int varid, const size_t *startp,
655  const size_t *countp, char *ip)
656 {
657  NC* ncp;
658  int stat = NC_check_id(ncid, &ncp);
659  if(stat != NC_NOERR) return stat;
660  return NC_get_vara(ncid, varid, startp, countp,
661  (void *)ip, NC_CHAR);
662 }
663 
664 int
665 nc_get_vara_schar(int ncid, int varid, const size_t *startp,
666  const size_t *countp, signed char *ip)
667 {
668  NC* ncp;
669  int stat = NC_check_id(ncid, &ncp);
670  if(stat != NC_NOERR) return stat;
671  return NC_get_vara(ncid, varid, startp, countp,
672  (void *)ip, NC_BYTE);
673 }
674 
675 int
676 nc_get_vara_uchar(int ncid, int varid, const size_t *startp,
677  const size_t *countp, unsigned char *ip)
678 {
679  NC* ncp;
680  int stat = NC_check_id(ncid, &ncp);
681  if(stat != NC_NOERR) return stat;
682  return NC_get_vara(ncid, varid, startp, countp,
683  (void *)ip, T_uchar);
684 }
685 
686 int
687 nc_get_vara_short(int ncid, int varid, const size_t *startp,
688  const size_t *countp, short *ip)
689 {
690  NC* ncp;
691  int stat = NC_check_id(ncid, &ncp);
692  if(stat != NC_NOERR) return stat;
693  return NC_get_vara(ncid, varid, startp, countp,
694  (void *)ip, NC_SHORT);
695 }
696 
697 int
698 nc_get_vara_int(int ncid, int varid,
699  const size_t *startp, const size_t *countp, int *ip)
700 {
701  NC* ncp;
702  int stat = NC_check_id(ncid, &ncp);
703  if(stat != NC_NOERR) return stat;
704  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_INT);
705 }
706 
707 int
708 nc_get_vara_long(int ncid, int varid,
709  const size_t *startp, const size_t *countp, long *ip)
710 {
711  NC* ncp;
712  int stat = NC_check_id(ncid, &ncp);
713  if(stat != NC_NOERR) return stat;
714  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_long);
715 }
716 
717 int
718 nc_get_vara_float(int ncid, int varid,
719  const size_t *startp, const size_t *countp, float *ip)
720 {
721  NC* ncp;
722  int stat = NC_check_id(ncid, &ncp);
723  if(stat != NC_NOERR) return stat;
724  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_float);
725 }
726 
727 
728 int
729 nc_get_vara_double(int ncid, int varid, const size_t *startp,
730  const size_t *countp, double *ip)
731 {
732  NC* ncp;
733  int stat = NC_check_id(ncid, &ncp);
734  if(stat != NC_NOERR) return stat;
735  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_double);
736 }
737 
738 int
739 nc_get_vara_ubyte(int ncid, int varid,
740  const size_t *startp, const size_t *countp, unsigned char *ip)
741 {
742  NC* ncp;
743  int stat = NC_check_id(ncid, &ncp);
744  if(stat != NC_NOERR) return stat;
745  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_ubyte);
746 }
747 
748 int
749 nc_get_vara_ushort(int ncid, int varid,
750  const size_t *startp, const size_t *countp, unsigned short *ip)
751 {
752  NC* ncp;
753  int stat = NC_check_id(ncid, &ncp);
754  if(stat != NC_NOERR) return stat;
755  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_ushort);
756 }
757 
758 int
759 nc_get_vara_uint(int ncid, int varid,
760  const size_t *startp, const size_t *countp, unsigned int *ip)
761 {
762  NC* ncp;
763  int stat = NC_check_id(ncid, &ncp);
764  if(stat != NC_NOERR) return stat;
765  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_uint);
766 }
767 
768 int
769 nc_get_vara_longlong(int ncid, int varid,
770  const size_t *startp, const size_t *countp, long long *ip)
771 {
772  NC* ncp;
773  int stat = NC_check_id(ncid, &ncp);
774  if(stat != NC_NOERR) return stat;
775  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_longlong);
776 }
777 
778 int
779 nc_get_vara_ulonglong(int ncid, int varid,
780  const size_t *startp, const size_t *countp, unsigned long long *ip)
781 {
782  NC* ncp;
783  int stat = NC_check_id(ncid, &ncp);
784  if(stat != NC_NOERR) return stat;
785  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_UINT64);
786 }
787 
788 #ifdef USE_NETCDF4
789 int
790 nc_get_vara_string(int ncid, int varid,
791  const size_t *startp, const size_t *countp, char* *ip)
792 {
793  NC* ncp;
794  int stat = NC_check_id(ncid, &ncp);
795  if(stat != NC_NOERR) return stat;
796  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_STRING);
797 }
798 
799 #endif /*USE_NETCDF4*/
800 
836 int
837 nc_get_var1(int ncid, int varid, const size_t *indexp, void *ip)
838 {
839  return NC_get_var1(ncid, varid, indexp, ip, NC_NAT);
840 }
841 
842 int
843 nc_get_var1_text(int ncid, int varid, const size_t *indexp, char *ip)
844 {
845  NC* ncp;
846  int stat = NC_check_id(ncid, &ncp);
847  if(stat != NC_NOERR) return stat;
848  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_CHAR);
849 }
850 
851 int
852 nc_get_var1_schar(int ncid, int varid, const size_t *indexp, signed char *ip)
853 {
854  NC* ncp;
855  int stat = NC_check_id(ncid, &ncp);
856  if(stat != NC_NOERR) return stat;
857  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_BYTE);
858 }
859 
860 int
861 nc_get_var1_uchar(int ncid, int varid, const size_t *indexp, unsigned char *ip)
862 {
863  NC* ncp;
864  int stat = NC_check_id(ncid, &ncp);
865  if(stat != NC_NOERR) return stat;
866  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UBYTE);
867 }
868 
869 int
870 nc_get_var1_short(int ncid, int varid, const size_t *indexp, short *ip)
871 {
872  NC* ncp;
873  int stat = NC_check_id(ncid, &ncp);
874  if(stat != NC_NOERR) return stat;
875  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_SHORT);
876 }
877 
878 int
879 nc_get_var1_int(int ncid, int varid, const size_t *indexp, int *ip)
880 {
881  NC* ncp;
882  int stat = NC_check_id(ncid, &ncp);
883  if(stat != NC_NOERR) return stat;
884  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_INT);
885 }
886 
887 int
888 nc_get_var1_long(int ncid, int varid, const size_t *indexp,
889  long *ip)
890 {
891  NC* ncp;
892  int stat = NC_check_id(ncid, &ncp);
893  if(stat != NC_NOERR) return stat;
894  return NC_get_var1(ncid, varid, indexp, (void *)ip, longtype);
895 }
896 
897 int
898 nc_get_var1_float(int ncid, int varid, const size_t *indexp,
899  float *ip)
900 {
901  NC* ncp;
902  int stat = NC_check_id(ncid, &ncp);
903  if(stat != NC_NOERR) return stat;
904  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_FLOAT);
905 }
906 
907 int
908 nc_get_var1_double(int ncid, int varid, const size_t *indexp,
909  double *ip)
910 {
911  NC* ncp;
912  int stat = NC_check_id(ncid, &ncp);
913  if(stat != NC_NOERR) return stat;
914  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_DOUBLE);
915 }
916 
917 int
918 nc_get_var1_ubyte(int ncid, int varid, const size_t *indexp,
919  unsigned char *ip)
920 {
921  NC* ncp;
922  int stat = NC_check_id(ncid, &ncp);
923  if(stat != NC_NOERR) return stat;
924  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UBYTE);
925 }
926 
927 int
928 nc_get_var1_ushort(int ncid, int varid, const size_t *indexp,
929  unsigned short *ip)
930 {
931  NC* ncp;
932  int stat = NC_check_id(ncid, &ncp);
933  if(stat != NC_NOERR) return stat;
934  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_USHORT);
935 }
936 
937 int
938 nc_get_var1_uint(int ncid, int varid, const size_t *indexp,
939  unsigned int *ip)
940 {
941  NC* ncp;
942  int stat = NC_check_id(ncid, &ncp);
943  if(stat != NC_NOERR) return stat;
944  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UINT);
945 }
946 
947 int
948 nc_get_var1_longlong(int ncid, int varid, const size_t *indexp,
949  long long *ip)
950 {
951  NC* ncp;
952  int stat = NC_check_id(ncid, &ncp);
953  if(stat != NC_NOERR) return stat;
954  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_INT64);
955 }
956 
957 int
958 nc_get_var1_ulonglong(int ncid, int varid, const size_t *indexp,
959  unsigned long long *ip)
960 {
961  NC* ncp;
962  int stat = NC_check_id(ncid, &ncp);
963  if(stat != NC_NOERR) return stat;
964  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UINT64);
965 }
966 
967 #ifdef USE_NETCDF4
968 int
969 nc_get_var1_string(int ncid, int varid, const size_t *indexp, char* *ip)
970 {
971  NC* ncp;
972  int stat = NC_check_id(ncid, &ncp);
973  if(stat != NC_NOERR) return stat;
974  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_STRING);
975 }
976 #endif /*USE_NETCDF4*/
977 
1022 int
1023 nc_get_var(int ncid, int varid, void *ip)
1024 {
1025  return NC_get_var(ncid, varid, ip, NC_NAT);
1026 }
1027 
1028 int
1029 nc_get_var_text(int ncid, int varid, char *ip)
1030 {
1031  NC *ncp;
1032  int stat = NC_check_id(ncid, &ncp);
1033  if(stat != NC_NOERR) return stat;
1034  return NC_get_var(ncid, varid, (void *)ip, NC_CHAR);
1035 }
1036 
1037 int
1038 nc_get_var_schar(int ncid, int varid, signed char *ip)
1039 {
1040  NC *ncp;
1041  int stat = NC_check_id(ncid, &ncp);
1042  if(stat != NC_NOERR) return stat;
1043  return NC_get_var(ncid, varid, (void *)ip, NC_BYTE);
1044 }
1045 
1046 int
1047 nc_get_var_uchar(int ncid, int varid, unsigned char *ip)
1048 {
1049  NC *ncp;
1050  int stat = NC_check_id(ncid, &ncp);
1051  if(stat != NC_NOERR) return stat;
1052  return NC_get_var(ncid,varid, (void *)ip, NC_UBYTE);
1053 }
1054 
1055 int
1056 nc_get_var_short(int ncid, int varid, short *ip)
1057 {
1058  NC* ncp;
1059  int stat = NC_check_id(ncid, &ncp);
1060  if(stat != NC_NOERR) return stat;
1061  return NC_get_var(ncid, varid, (void *)ip, NC_SHORT);
1062 }
1063 
1064 int
1065 nc_get_var_int(int ncid, int varid, int *ip)
1066 {
1067  NC* ncp;
1068  int stat = NC_check_id(ncid, &ncp);
1069  if(stat != NC_NOERR) return stat;
1070  return NC_get_var(ncid,varid, (void *)ip, NC_INT);
1071 }
1072 
1073 int
1074 nc_get_var_long(int ncid, int varid, long *ip)
1075 {
1076  NC* ncp;
1077  int stat = NC_check_id(ncid, &ncp);
1078  if(stat != NC_NOERR) return stat;
1079  return NC_get_var(ncid,varid, (void *)ip, longtype);
1080 }
1081 
1082 int
1083 nc_get_var_float(int ncid, int varid, float *ip)
1084 {
1085  NC* ncp;
1086  int stat = NC_check_id(ncid, &ncp);
1087  if(stat != NC_NOERR) return stat;
1088  return NC_get_var(ncid,varid, (void *)ip, NC_FLOAT);
1089 }
1090 
1091 int
1092 nc_get_var_double(int ncid, int varid, double *ip)
1093 {
1094  NC* ncp;
1095  int stat = NC_check_id(ncid, &ncp);
1096  if(stat != NC_NOERR) return stat;
1097  return NC_get_var(ncid,varid, (void *)ip, NC_DOUBLE);
1098 }
1099 
1100 int
1101 nc_get_var_ubyte(int ncid, int varid, unsigned char *ip)
1102 {
1103  NC* ncp;
1104  int stat = NC_check_id(ncid, &ncp);
1105  if(stat != NC_NOERR) return stat;
1106  return NC_get_var(ncid,varid, (void *)ip, NC_UBYTE);
1107 }
1108 
1109 int
1110 nc_get_var_ushort(int ncid, int varid, unsigned short *ip)
1111 {
1112  NC* ncp;
1113  int stat = NC_check_id(ncid, &ncp);
1114  if(stat != NC_NOERR) return stat;
1115  return NC_get_var(ncid,varid, (void *)ip, NC_USHORT);
1116 }
1117 
1118 int
1119 nc_get_var_uint(int ncid, int varid, unsigned int *ip)
1120 {
1121  NC* ncp;
1122  int stat = NC_check_id(ncid, &ncp);
1123  if(stat != NC_NOERR) return stat;
1124  return NC_get_var(ncid,varid, (void *)ip, NC_UINT);
1125 }
1126 
1127 int
1128 nc_get_var_longlong(int ncid, int varid, long long *ip)
1129 {
1130  NC* ncp;
1131  int stat = NC_check_id(ncid, &ncp);
1132  if(stat != NC_NOERR) return stat;
1133  return NC_get_var(ncid,varid, (void *)ip, NC_INT64);
1134 }
1135 
1136 int
1137 nc_get_var_ulonglong(int ncid, int varid, unsigned long long *ip)
1138 {
1139  NC* ncp;
1140  int stat = NC_check_id(ncid, &ncp);
1141  if(stat != NC_NOERR) return stat;
1142  return NC_get_var(ncid,varid, (void *)ip,NC_UINT64);
1143 }
1144 
1145 #ifdef USE_NETCDF4
1146 int
1147 nc_get_var_string(int ncid, int varid, char* *ip)
1148 {
1149  NC* ncp;
1150  int stat = NC_check_id(ncid, &ncp);
1151  if(stat != NC_NOERR) return stat;
1152  return NC_get_var(ncid,varid, (void *)ip,NC_STRING);
1153 }
1154 #endif /*USE_NETCDF4*/
1155 
1197 int
1198 nc_get_vars (int ncid, int varid, const size_t * startp,
1199  const size_t * countp, const ptrdiff_t * stridep,
1200  void *ip)
1201 {
1202  NC* ncp;
1203  int stat = NC_NOERR;
1204 
1205  if ((stat = NC_check_id(ncid, &ncp)))
1206  return stat;
1207  return ncp->dispatch->get_vars(ncid, varid, startp, countp, stridep,
1208  ip, NC_NAT);
1209 }
1210 
1211 int
1212 nc_get_vars_text(int ncid, int varid, const size_t *startp,
1213  const size_t *countp, const ptrdiff_t * stridep,
1214  char *ip)
1215 {
1216  NC* ncp;
1217  int stat = NC_check_id(ncid, &ncp);
1218  if(stat != NC_NOERR) return stat;
1219  return NC_get_vars(ncid,varid,startp, countp, stridep,
1220  (void *)ip, NC_CHAR);
1221 }
1222 
1223 int
1224 nc_get_vars_schar(int ncid, int varid, const size_t *startp,
1225  const size_t *countp, const ptrdiff_t * stridep,
1226  signed char *ip)
1227 {
1228  NC* ncp;
1229  int stat = NC_check_id(ncid, &ncp);
1230  if(stat != NC_NOERR) return stat;
1231  return NC_get_vars(ncid,varid,startp, countp, stridep,
1232  (void *)ip, NC_BYTE);
1233 }
1234 
1235 int
1236 nc_get_vars_uchar(int ncid, int varid, const size_t *startp,
1237  const size_t *countp, const ptrdiff_t * stridep,
1238  unsigned char *ip)
1239 {
1240  NC* ncp;
1241  int stat = NC_check_id(ncid, &ncp);
1242  if(stat != NC_NOERR) return stat;
1243  return NC_get_vars(ncid,varid,startp, countp, stridep,
1244  (void *)ip, T_uchar);
1245 }
1246 
1247 int
1248 nc_get_vars_short(int ncid, int varid, const size_t *startp,
1249  const size_t *countp, const ptrdiff_t *stridep,
1250  short *ip)
1251 {
1252  NC* ncp;
1253  int stat = NC_check_id(ncid, &ncp);
1254  if(stat != NC_NOERR) return stat;
1255  return NC_get_vars(ncid,varid,startp, countp, stridep,
1256  (void *)ip, NC_SHORT);
1257 }
1258 
1259 int
1260 nc_get_vars_int(int ncid, int varid, const size_t *startp,
1261  const size_t *countp, const ptrdiff_t * stridep,
1262  int *ip)
1263 {
1264  NC* ncp;
1265  int stat = NC_check_id(ncid, &ncp);
1266  if(stat != NC_NOERR) return stat;
1267  return NC_get_vars(ncid,varid,startp, countp, stridep,
1268  (void *)ip, NC_INT);
1269 }
1270 
1271 int
1272 nc_get_vars_long(int ncid, int varid, const size_t *startp,
1273  const size_t *countp, const ptrdiff_t * stridep,
1274  long *ip)
1275 {
1276  NC* ncp;
1277  int stat = NC_check_id(ncid, &ncp);
1278  if(stat != NC_NOERR) return stat;
1279  return NC_get_vars(ncid,varid,startp, countp, stridep,
1280  (void *)ip, T_long);
1281 }
1282 
1283 int
1284 nc_get_vars_float(int ncid, int varid, const size_t *startp,
1285  const size_t *countp, const ptrdiff_t * stridep,
1286  float *ip)
1287 {
1288  NC* ncp;
1289  int stat = NC_check_id(ncid, &ncp);
1290  if(stat != NC_NOERR) return stat;
1291  return NC_get_vars(ncid,varid,startp, countp, stridep,
1292  (void *)ip, T_float);
1293 }
1294 
1295 int
1296 nc_get_vars_double(int ncid, int varid, const size_t *startp,
1297  const size_t *countp, const ptrdiff_t * stridep,
1298  double *ip)
1299 {
1300  NC* ncp;
1301  int stat = NC_check_id(ncid, &ncp);
1302  if(stat != NC_NOERR) return stat;
1303  return NC_get_vars(ncid,varid,startp, countp, stridep,
1304  (void *)ip, T_double);
1305 }
1306 
1307 int
1308 nc_get_vars_ubyte(int ncid, int varid, const size_t *startp,
1309  const size_t *countp, const ptrdiff_t * stridep,
1310  unsigned char *ip)
1311 {
1312  NC* ncp;
1313  int stat = NC_check_id(ncid, &ncp);
1314  if(stat != NC_NOERR) return stat;
1315  return NC_get_vars(ncid,varid, startp, countp, stridep,
1316  (void *)ip, T_ubyte);
1317 }
1318 
1319 int
1320 nc_get_vars_ushort(int ncid, int varid, const size_t *startp,
1321  const size_t *countp, const ptrdiff_t * stridep,
1322  unsigned short *ip)
1323 {
1324  NC* ncp;
1325  int stat = NC_check_id(ncid, &ncp);
1326  if(stat != NC_NOERR) return stat;
1327  return NC_get_vars(ncid,varid,startp,countp, stridep,
1328  (void *)ip, T_ushort);
1329 }
1330 
1331 int
1332 nc_get_vars_uint(int ncid, int varid, const size_t *startp,
1333  const size_t *countp, const ptrdiff_t * stridep,
1334  unsigned int *ip)
1335 {
1336  NC* ncp;
1337  int stat = NC_check_id(ncid, &ncp);
1338  if(stat != NC_NOERR) return stat;
1339  return NC_get_vars(ncid,varid,startp, countp, stridep,
1340  (void *)ip, T_uint);
1341 }
1342 
1343 int
1344 nc_get_vars_longlong(int ncid, int varid, const size_t *startp,
1345  const size_t *countp, const ptrdiff_t * stridep,
1346  long long *ip)
1347 {
1348  NC* ncp;
1349  int stat = NC_check_id(ncid, &ncp);
1350  if(stat != NC_NOERR) return stat;
1351  return NC_get_vars(ncid, varid, startp, countp, stridep,
1352  (void *)ip, T_longlong);
1353 }
1354 
1355 int
1356 nc_get_vars_ulonglong(int ncid, int varid, const size_t *startp,
1357  const size_t *countp, const ptrdiff_t * stridep,
1358  unsigned long long *ip)
1359 {
1360  NC* ncp;
1361  int stat = NC_check_id(ncid, &ncp);
1362  if(stat != NC_NOERR) return stat;
1363  return NC_get_vars(ncid, varid, startp, countp, stridep,
1364  (void *)ip, NC_UINT64);
1365 }
1366 
1367 #ifdef USE_NETCDF4
1368 int
1369 nc_get_vars_string(int ncid, int varid,
1370  const size_t *startp, const size_t *countp,
1371  const ptrdiff_t * stridep,
1372  char* *ip)
1373 {
1374  NC* ncp;
1375  int stat = NC_check_id(ncid, &ncp);
1376  if(stat != NC_NOERR) return stat;
1377  return NC_get_vars(ncid, varid, startp, countp, stridep,
1378  (void *)ip, NC_STRING);
1379 }
1380 #endif /*USE_NETCDF4*/
1381 
1438 int
1439 nc_get_varm(int ncid, int varid, const size_t * startp,
1440  const size_t * countp, const ptrdiff_t * stridep,
1441  const ptrdiff_t * imapp, void *ip)
1442 {
1443  NC* ncp;
1444  int stat = NC_NOERR;
1445 
1446  if ((stat = NC_check_id(ncid, &ncp)))
1447  return stat;
1448  return ncp->dispatch->get_varm(ncid, varid, startp, countp,
1449  stridep, imapp, ip, NC_NAT);
1450 }
1451 
1452 int
1453 nc_get_varm_schar(int ncid, int varid,
1454  const size_t *startp, const size_t *countp,
1455  const ptrdiff_t *stridep,
1456  const ptrdiff_t *imapp, signed char *ip)
1457 {
1458  NC *ncp;
1459  int stat = NC_check_id(ncid, &ncp);
1460  if(stat != NC_NOERR) return stat;
1461  return NC_get_varm(ncid, varid, startp, countp,
1462  stridep, imapp, (void *)ip, NC_BYTE);
1463 }
1464 
1465 int
1466 nc_get_varm_uchar(int ncid, int varid,
1467  const size_t *startp, const size_t *countp,
1468  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1469  unsigned char *ip)
1470 {
1471  NC *ncp;
1472  int stat = NC_check_id(ncid, &ncp);
1473  if(stat != NC_NOERR) return stat;
1474  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_uchar);
1475 }
1476 
1477 int
1478 nc_get_varm_short(int ncid, int varid, const size_t *startp,
1479  const size_t *countp, const ptrdiff_t *stridep,
1480  const ptrdiff_t *imapp, short *ip)
1481 {
1482  NC *ncp;
1483  int stat = NC_check_id(ncid, &ncp);
1484  if(stat != NC_NOERR) return stat;
1485  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,NC_SHORT);
1486 }
1487 
1488 int
1489 nc_get_varm_int(int ncid, int varid,
1490  const size_t *startp, const size_t *countp,
1491  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1492  int *ip)
1493 {
1494  NC *ncp;
1495  int stat = NC_check_id(ncid, &ncp);
1496  if(stat != NC_NOERR) return stat;
1497  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,NC_INT);
1498 }
1499 
1500 int
1501 nc_get_varm_long(int ncid, int varid,
1502  const size_t *startp, const size_t *countp,
1503  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1504  long *ip)
1505 {
1506  NC *ncp;
1507  int stat = NC_check_id(ncid, &ncp);
1508  if(stat != NC_NOERR) return stat;
1509  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_long);
1510 }
1511 
1512 int
1513 nc_get_varm_float(int ncid, int varid,
1514  const size_t *startp, const size_t *countp,
1515  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1516  float *ip)
1517 {
1518  NC *ncp;
1519  int stat = NC_check_id(ncid, &ncp);
1520  if(stat != NC_NOERR) return stat;
1521  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_float);
1522 }
1523 
1524 int
1525 nc_get_varm_double(int ncid, int varid,
1526  const size_t *startp, const size_t *countp,
1527  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1528  double *ip)
1529 {
1530  NC *ncp;
1531  int stat = NC_check_id(ncid, &ncp);
1532  if(stat != NC_NOERR) return stat;
1533  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_double);
1534 }
1535 
1536 int
1537 nc_get_varm_ubyte(int ncid, int varid,
1538  const size_t *startp, const size_t *countp,
1539  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1540  unsigned char *ip)
1541 {
1542  NC *ncp;
1543  int stat = NC_check_id(ncid, &ncp);
1544  if(stat != NC_NOERR) return stat;
1545  return NC_get_varm(ncid,varid,startp,countp,stridep,
1546  imapp, (void *)ip, T_ubyte);
1547 }
1548 
1549 int
1550 nc_get_varm_ushort(int ncid, int varid,
1551  const size_t *startp, const size_t *countp,
1552  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1553  unsigned short *ip)
1554 {
1555  NC *ncp;
1556  int stat = NC_check_id(ncid, &ncp);
1557  if(stat != NC_NOERR) return stat;
1558  return NC_get_varm(ncid, varid, startp, countp, stridep,
1559  imapp, (void *)ip, T_ushort);
1560 }
1561 
1562 int
1563 nc_get_varm_uint(int ncid, int varid,
1564  const size_t *startp, const size_t *countp,
1565  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1566  unsigned int *ip)
1567 {
1568  NC *ncp;
1569  int stat = NC_check_id(ncid, &ncp);
1570  if(stat != NC_NOERR) return stat;
1571  return NC_get_varm(ncid, varid, startp, countp,
1572  stridep, imapp, (void *)ip, T_uint);
1573 }
1574 
1575 int
1576 nc_get_varm_longlong(int ncid, int varid, const size_t *startp,
1577  const size_t *countp, const ptrdiff_t *stridep,
1578  const ptrdiff_t *imapp, long long *ip)
1579 {
1580  NC *ncp;
1581  int stat = NC_check_id(ncid, &ncp);
1582  if(stat != NC_NOERR) return stat;
1583  return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1584  (void *)ip, T_longlong);
1585 }
1586 
1587 int
1588 nc_get_varm_ulonglong(int ncid, int varid,
1589  const size_t *startp, const size_t *countp,
1590  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1591  unsigned long long *ip)
1592 {
1593  NC *ncp;
1594  int stat = NC_check_id(ncid, &ncp);
1595  if(stat != NC_NOERR) return stat;
1596  return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1597  (void *)ip, NC_UINT64);
1598 }
1599 
1600 int
1601 nc_get_varm_text(int ncid, int varid, const size_t *startp,
1602  const size_t *countp, const ptrdiff_t *stridep,
1603  const ptrdiff_t *imapp, char *ip)
1604 {
1605  NC *ncp;
1606  int stat = NC_check_id(ncid, &ncp);
1607  if(stat != NC_NOERR) return stat;
1608  return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1609  (void *)ip, NC_CHAR);
1610 }
1611 
1612 #ifdef USE_NETCDF4
1613 int
1614 nc_get_varm_string(int ncid, int varid, const size_t *startp,
1615  const size_t *countp, const ptrdiff_t *stridep,
1616  const ptrdiff_t *imapp, char **ip)
1617 {
1618  NC *ncp;
1619  int stat = NC_check_id(ncid, &ncp);
1620  if(stat != NC_NOERR) return stat;
1621  return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1622  (void *)ip, NC_STRING);
1623 }
1625 #endif /*USE_NETCDF4*/
1626 
1627  /* End of named group... */
int nc_get_vara_uint(int ncid, int varid, const size_t *startp, const size_t *countp, unsigned int *ip)
Read an array of values from a variable.
Definition: dvarget.c:759
int nc_get_var_uint(int ncid, int varid, unsigned int *ip)
Read an entire variable in one call.
Definition: dvarget.c:1119
int nc_get_var1_text(int ncid, int varid, const size_t *indexp, char *ip)
Read a single datum from a variable.
Definition: dvarget.c:843
#define NC_ENOMEM
Memory allocation (malloc) failure.
Definition: netcdf.h:354
int nc_get_var_ulonglong(int ncid, int varid, unsigned long long *ip)
Read an entire variable in one call.
Definition: dvarget.c:1137
#define NC_CHAR
ISO/ASCII character.
Definition: netcdf.h:39
int nc_get_varm_short(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, short *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1478
int nc_get_varm_ubyte(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, unsigned char *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1537
int nc_get_vara_double(int ncid, int varid, const size_t *startp, const size_t *countp, double *ip)
Read an array of values from a variable.
Definition: dvarget.c:729
int nc_get_varm_float(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, float *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1513
#define NC_UBYTE
unsigned 1 byte int
Definition: netcdf.h:45
#define NC_EMAPTYPE
Mapped access for atomic types only.
Definition: netcdf.h:407
#define NC_ERANGE
Math result not representable.
Definition: netcdf.h:353
#define NC_MAX_VAR_DIMS
max per variable dimensions
Definition: netcdf.h:233
int nc_get_vars_text(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, char *ip)
Read a strided array from a variable.
Definition: dvarget.c:1212
int nc_get_vars_ubyte(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, unsigned char *ip)
Read a strided array from a variable.
Definition: dvarget.c:1308
int nc_get_var1_string(int ncid, int varid, const size_t *indexp, char **ip)
Read a single datum from a variable.
Definition: dvarget.c:969
#define NC_UINT
unsigned 4-byte int
Definition: netcdf.h:47
int nc_get_var_long(int ncid, int varid, long *ip)
Read an entire variable in one call.
Definition: dvarget.c:1074
#define NC_EINVALCOORDS
Index exceeds dimension bound.
Definition: netcdf.h:311
int nc_get_varm_schar(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, signed char *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1453
#define NC_INT64
signed 8-byte int
Definition: netcdf.h:48
#define NC_STRING
string
Definition: netcdf.h:50
#define NC_DOUBLE
double precision floating point number
Definition: netcdf.h:44
int nc_get_vars_double(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, double *ip)
Read a strided array from a variable.
Definition: dvarget.c:1296
EXTERNL int nc_inq_varndims(int ncid, int varid, int *ndimsp)
Learn how many dimensions are associated with a variable.
Definition: dvarinq.c:191
int nc_get_var_schar(int ncid, int varid, signed char *ip)
Read an entire variable in one call.
Definition: dvarget.c:1038
int nc_get_varm(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, void *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1439
int nc_type
The nc_type type is just an int.
Definition: netcdf.h:28
int nc_get_vara_string(int ncid, int varid, const size_t *startp, const size_t *countp, char **ip)
Read an array of values from a variable.
Definition: dvarget.c:790
#define NC_BYTE
signed 1 byte integer
Definition: netcdf.h:38
int nc_get_var1_longlong(int ncid, int varid, const size_t *indexp, long long *ip)
Read a single datum from a variable.
Definition: dvarget.c:948
int nc_get_varm_int(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, int *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1489
int nc_get_vars_longlong(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, long long *ip)
Read a strided array from a variable.
Definition: dvarget.c:1344
int nc_get_vara_ushort(int ncid, int varid, const size_t *startp, const size_t *countp, unsigned short *ip)
Read an array of values from a variable.
Definition: dvarget.c:749
int nc_get_var(int ncid, int varid, void *ip)
Read an entire variable in one call.
Definition: dvarget.c:1023
int nc_get_var_int(int ncid, int varid, int *ip)
Read an entire variable in one call.
Definition: dvarget.c:1065
int nc_get_vara_short(int ncid, int varid, const size_t *startp, const size_t *countp, short *ip)
Read an array of values from a variable.
Definition: dvarget.c:687
int nc_get_var_ushort(int ncid, int varid, unsigned short *ip)
Read an entire variable in one call.
Definition: dvarget.c:1110
int nc_get_var_double(int ncid, int varid, double *ip)
Read an entire variable in one call.
Definition: dvarget.c:1092
int nc_get_vara_float(int ncid, int varid, const size_t *startp, const size_t *countp, float *ip)
Read an array of values from a variable.
Definition: dvarget.c:718
int nc_get_varm_uint(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, unsigned int *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1563
int nc_get_var_string(int ncid, int varid, char **ip)
Read an entire variable in one call.
Definition: dvarget.c:1147
#define NC_EBADTYPE
Not a netcdf data type.
Definition: netcdf.h:316
#define NC_EEDGE
Start+count exceeds dimension bound.
Definition: netcdf.h:344
int nc_get_var1_ubyte(int ncid, int varid, const size_t *indexp, unsigned char *ip)
Read a single datum from a variable.
Definition: dvarget.c:918
int nc_get_var1_uchar(int ncid, int varid, const size_t *indexp, unsigned char *ip)
Read a single datum from a variable.
Definition: dvarget.c:861
int nc_get_var1(int ncid, int varid, const size_t *indexp, void *ip)
Read a single datum from a variable.
Definition: dvarget.c:837
int nc_get_vara_int(int ncid, int varid, const size_t *startp, const size_t *countp, int *ip)
Read an array of values from a variable.
Definition: dvarget.c:698
#define NC_ESTRIDE
Illegal stride.
Definition: netcdf.h:345
int nc_get_var1_uint(int ncid, int varid, const size_t *indexp, unsigned int *ip)
Read a single datum from a variable.
Definition: dvarget.c:938
#define NC_EINVAL
Invalid Argument.
Definition: netcdf.h:289
int nc_get_vara_longlong(int ncid, int varid, const size_t *startp, const size_t *countp, long long *ip)
Read an array of values from a variable.
Definition: dvarget.c:769
#define NC_INT
signed 4 byte integer
Definition: netcdf.h:41
int nc_get_vara_ulonglong(int ncid, int varid, const size_t *startp, const size_t *countp, unsigned long long *ip)
Read an array of values from a variable.
Definition: dvarget.c:779
int nc_get_vars_uchar(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, unsigned char *ip)
Read a strided array from a variable.
Definition: dvarget.c:1236
int nc_get_var_text(int ncid, int varid, char *ip)
Read an entire variable in one call.
Definition: dvarget.c:1029
int nc_get_varm_uchar(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, unsigned char *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1466
int nc_get_vars_ulonglong(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, unsigned long long *ip)
Read a strided array from a variable.
Definition: dvarget.c:1356
int nc_get_vars_int(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, int *ip)
Read a strided array from a variable.
Definition: dvarget.c:1260
int nc_get_vara_ubyte(int ncid, int varid, const size_t *startp, const size_t *countp, unsigned char *ip)
Read an array of values from a variable.
Definition: dvarget.c:739
int nc_get_var1_float(int ncid, int varid, const size_t *indexp, float *ip)
Read a single datum from a variable.
Definition: dvarget.c:898
int nc_get_vara_text(int ncid, int varid, const size_t *startp, const size_t *countp, char *ip)
Read an array of values from a variable.
Definition: dvarget.c:654
#define NC_NAT
Not A Type.
Definition: netcdf.h:37
int nc_get_vara_schar(int ncid, int varid, const size_t *startp, const size_t *countp, signed char *ip)
Read an array of values from a variable.
Definition: dvarget.c:665
EXTERNL int nc_inq_vartype(int ncid, int varid, nc_type *xtypep)
Learn the type of a variable.
Definition: dvarinq.c:168
int nc_get_vars_float(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, float *ip)
Read a strided array from a variable.
Definition: dvarget.c:1284
EXTERNL int nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size)
Inquire about a type.
Definition: dfile.c:1447
#define NC_USHORT
unsigned 2-byte int
Definition: netcdf.h:46
int nc_get_var_ubyte(int ncid, int varid, unsigned char *ip)
Read an entire variable in one call.
Definition: dvarget.c:1101
int nc_get_var_longlong(int ncid, int varid, long long *ip)
Read an entire variable in one call.
Definition: dvarget.c:1128
int nc_get_vars_short(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, short *ip)
Read a strided array from a variable.
Definition: dvarget.c:1248
int nc_get_var1_ushort(int ncid, int varid, const size_t *indexp, unsigned short *ip)
Read a single datum from a variable.
Definition: dvarget.c:928
int nc_get_varm_text(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, char *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1601
int nc_get_var1_schar(int ncid, int varid, const size_t *indexp, signed char *ip)
Read a single datum from a variable.
Definition: dvarget.c:852
int nc_get_vars_schar(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, signed char *ip)
Read a strided array from a variable.
Definition: dvarget.c:1224
int nc_get_vars_long(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, long *ip)
Read a strided array from a variable.
Definition: dvarget.c:1272
int nc_get_vars_ushort(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, unsigned short *ip)
Read a strided array from a variable.
Definition: dvarget.c:1320
int nc_get_vara_uchar(int ncid, int varid, const size_t *startp, const size_t *countp, unsigned char *ip)
Read an array of values from a variable.
Definition: dvarget.c:676
int nc_get_var_float(int ncid, int varid, float *ip)
Read an entire variable in one call.
Definition: dvarget.c:1083
int nc_get_var1_short(int ncid, int varid, const size_t *indexp, short *ip)
Read a single datum from a variable.
Definition: dvarget.c:870
int nc_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, void *ip)
Read a strided array from a variable.
Definition: dvarget.c:1198
int nc_get_var_short(int ncid, int varid, short *ip)
Read an entire variable in one call.
Definition: dvarget.c:1056
#define NC_SHORT
signed 2 byte integer
Definition: netcdf.h:40
int nc_get_var1_ulonglong(int ncid, int varid, const size_t *indexp, unsigned long long *ip)
Read a single datum from a variable.
Definition: dvarget.c:958
int nc_get_var1_double(int ncid, int varid, const size_t *indexp, double *ip)
Read a single datum from a variable.
Definition: dvarget.c:908
int nc_get_var_uchar(int ncid, int varid, unsigned char *ip)
Read an entire variable in one call.
Definition: dvarget.c:1047
#define NC_NOERR
No Error.
Definition: netcdf.h:279
#define NC_ECHAR
Attempt to convert between text & numbers.
Definition: netcdf.h:335
int nc_get_var1_long(int ncid, int varid, const size_t *indexp, long *ip)
Read a single datum from a variable.
Definition: dvarget.c:888
int nc_get_varm_long(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, long *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1501
int nc_get_var1_int(int ncid, int varid, const size_t *indexp, int *ip)
Read a single datum from a variable.
Definition: dvarget.c:879
int nc_get_varm_ushort(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, unsigned short *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1550
#define NC_FLOAT
single precision floating point number
Definition: netcdf.h:43
int nc_get_varm_string(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, char **ip)
Read a mapped array from a variable.
Definition: dvarget.c:1614
int nc_get_varm_double(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, double *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1525
int nc_get_vara(int ncid, int varid, const size_t *startp, const size_t *countp, void *ip)
Read an array of values from a variable.
Definition: dvarget.c:641
#define NC_UINT64
unsigned 8-byte int
Definition: netcdf.h:49
int nc_get_vara_long(int ncid, int varid, const size_t *startp, const size_t *countp, long *ip)
Read an array of values from a variable.
Definition: dvarget.c:708
int nc_get_varm_longlong(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, long long *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1576
int nc_get_vars_string(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, char **ip)
Read a strided array from a variable.
Definition: dvarget.c:1369
int nc_get_vars_uint(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, unsigned int *ip)
Read a strided array from a variable.
Definition: dvarget.c:1332
int nc_get_varm_ulonglong(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const ptrdiff_t *imapp, unsigned long long *ip)
Read a mapped array from a variable.
Definition: dvarget.c:1588

Return to the Main Unidata NetCDF page.
Generated on Mon Jul 13 2015 07:53:24 for NetCDF. NetCDF is a Unidata library.