NetCDF  4.4.0
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  char* value = (char*)value0;
281 
282  status = NC_check_id (ncid, &ncp);
283  if(status != NC_NOERR) return status;
284 
285 /*
286  if(NC_indef(ncp)) return NC_EINDEFINE;
287 */
288 
289  status = nc_inq_vartype(ncid, varid, &vartype);
290  if(status != NC_NOERR) return status;
291  /* Check that this is an atomic type */
292  if(vartype > NC_MAX_ATOMIC_TYPE)
293  return NC_EMAPTYPE;
294 
295  status = nc_inq_varndims(ncid, varid, &varndims);
296  if(status != NC_NOERR) return status;
297 
298  if(memtype == NC_NAT) {
299  memtype = vartype;
300  }
301 
302  if(memtype == NC_CHAR && vartype != NC_CHAR)
303  return NC_ECHAR;
304  else if(memtype != NC_CHAR && vartype == NC_CHAR)
305  return NC_ECHAR;
306 
307  memtypelen = nctypelen(memtype);
308 
309  maxidim = (int) varndims - 1;
310 
311  if (maxidim < 0)
312  {
313  /*
314  * The variable is a scalar; consequently,
315  * there s only one thing to get and only one place to put it.
316  * (Why was I called?)
317  */
318  size_t edge1[1] = {1};
319  return NC_get_vara(ncid, varid, start, edge1, value, memtype);
320  }
321 
322  /*
323  * else
324  * The variable is an array.
325  */
326  {
327  int idim;
328  size_t *mystart = NULL;
329  size_t *myedges;
330  size_t *iocount; /* count vector */
331  size_t *stop; /* stop indexes */
332  size_t *length; /* edge lengths in bytes */
333  ptrdiff_t *mystride;
334  ptrdiff_t *mymap;
335  size_t varshape[NC_MAX_VAR_DIMS];
336  int isrecvar;
337  size_t numrecs;
338 
339  /* Compute some dimension related values */
340  isrecvar = NC_is_recvar(ncid,varid,&numrecs);
341  NC_getshape(ncid,varid,varndims,varshape);
342 
343  /*
344  * Verify stride argument; also see if stride is all ones
345  */
346  if(stride != NULL) {
347  int stride1 = 1;
348  for (idim = 0; idim <= maxidim; ++idim)
349  {
350  if (stride[idim] == 0
351  /* cast needed for braindead systems with signed size_t */
352  || ((unsigned long) stride[idim] >= X_INT_MAX))
353  {
354  return NC_ESTRIDE;
355  }
356  if(stride[idim] != 1) stride1 = 0;
357  }
358  /* If stride1 is true, and there is no imap
359  then call get_vara directly.
360  */
361  if(stride1 && imapp == NULL) {
362  return NC_get_vara(ncid, varid, start, edges, value, memtype);
363  }
364  }
365 
366  /* assert(sizeof(ptrdiff_t) >= sizeof(size_t)); */
367  /* Allocate space for mystart,mystride,mymap etc.all at once */
368  mystart = (size_t *)calloc((size_t)(varndims * 7), sizeof(ptrdiff_t));
369  if(mystart == NULL) return NC_ENOMEM;
370  myedges = mystart + varndims;
371  iocount = myedges + varndims;
372  stop = iocount + varndims;
373  length = stop + varndims;
374  mystride = (ptrdiff_t *)(length + varndims);
375  mymap = mystride + varndims;
376 
377  /*
378  * Initialize I/O parameters.
379  */
380  for (idim = maxidim; idim >= 0; --idim)
381  {
382  mystart[idim] = start != NULL
383  ? start[idim]
384  : 0;
385 
386  if (edges != NULL && edges[idim] == 0)
387  {
388  status = NC_NOERR; /* read/write no data */
389  goto done;
390  }
391 
392 #ifdef COMPLEX
393  myedges[idim] = edges != NULL
394  ? edges[idim]
395  : idim == 0 && isrecvar
396  ? numrecs - mystart[idim]
397  : varshape[idim] - mystart[idim];
398 #else
399  if(edges != NULL)
400  myedges[idim] = edges[idim];
401  else if (idim == 0 && isrecvar)
402  myedges[idim] = numrecs - mystart[idim];
403  else
404  myedges[idim] = varshape[idim] - mystart[idim];
405 #endif
406 
407  mystride[idim] = stride != NULL
408  ? stride[idim]
409  : 1;
410 
411  /* Remember: in netCDF-2 imapp is byte oriented, not index oriented
412  * Starting from netCDF-3, imapp is index oriented */
413 #ifdef COMPLEX
414  mymap[idim] = (imapp != NULL
415  ? imapp[idim]
416  : (idim == maxidim ? 1
417  : mymap[idim + 1] * (ptrdiff_t) myedges[idim + 1]));
418 #else
419  if(imapp != NULL)
420  mymap[idim] = imapp[idim];
421  else if (idim == maxidim)
422  mymap[idim] = 1;
423  else
424  mymap[idim] =
425  mymap[idim + 1] * (ptrdiff_t) myedges[idim + 1];
426 #endif
427  iocount[idim] = 1;
428  length[idim] = ((size_t)mymap[idim]) * myedges[idim];
429  stop[idim] = (mystart[idim] + myedges[idim] * (size_t)mystride[idim]);
430  }
431 
432  /*
433  * Check start, edges
434  */
435  for (idim = maxidim; idim >= 0; --idim)
436  {
437  size_t dimlen =
438  idim == 0 && isrecvar
439  ? numrecs
440  : varshape[idim];
441  if (mystart[idim] >= dimlen)
442  {
443  status = NC_EINVALCOORDS;
444  goto done;
445  }
446 
447  if (mystart[idim] + myedges[idim] > dimlen)
448  {
449  status = NC_EEDGE;
450  goto done;
451  }
452 
453  }
454 
455 
456  /* Lower body */
457  /*
458  * As an optimization, adjust I/O parameters when the fastest
459  * dimension has unity stride both externally and internally.
460  * In this case, the user could have called a simpler routine
461  * (i.e. ncvar$1()
462  */
463  if (mystride[maxidim] == 1
464  && mymap[maxidim] == 1)
465  {
466  iocount[maxidim] = myedges[maxidim];
467  mystride[maxidim] = (ptrdiff_t) myedges[maxidim];
468  mymap[maxidim] = (ptrdiff_t) length[maxidim];
469  }
470 
471  /*
472  * Perform I/O. Exit when done.
473  */
474  for (;;)
475  {
476  /* TODO: */
477  int lstatus = NC_get_vara(ncid, varid, mystart, iocount,
478  value, memtype);
479  if (lstatus != NC_NOERR) {
480  if(status == NC_NOERR || lstatus != NC_ERANGE)
481  status = lstatus;
482  }
483  /*
484  * The following code permutes through the variable s
485  * external start-index space and it s internal address
486  * space. At the UPC, this algorithm is commonly
487  * called "odometer code".
488  */
489  idim = maxidim;
490  carry:
491  value += (((int)mymap[idim]) * memtypelen);
492  mystart[idim] += (size_t)mystride[idim];
493  if (mystart[idim] == stop[idim])
494  {
495  size_t l = (length[idim] * (size_t)memtypelen);
496  value -= l;
497  mystart[idim] = start[idim];
498  if (--idim < 0)
499  break; /* normal return */
500  goto carry;
501  }
502  } /* I/O loop */
503  done:
504  free(mystart);
505  } /* variable is array */
506  return status;
507 }
508 
512 static int
513 NC_get_vars(int ncid, int varid, const size_t *start,
514  const size_t *edges, const ptrdiff_t *stride, void *value,
515  nc_type memtype)
516 {
517  NC* ncp;
518  int stat = NC_check_id(ncid, &ncp);
519 
520  if(stat != NC_NOERR) return stat;
521 #ifdef USE_NETCDF4
522  if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
523 #endif
524  return ncp->dispatch->get_vars(ncid,varid,start,edges,stride,value,memtype);
525 }
526 
531 static int
532 NC_get_varm(int ncid, int varid, const size_t *start,
533  const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t* map,
534  void *value, nc_type memtype)
535 {
536  NC* ncp;
537  int stat = NC_check_id(ncid, &ncp);
538 
539  if(stat != NC_NOERR) return stat;
540 #ifdef USE_NETCDF4
541  if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
542 #endif
543  return ncp->dispatch->get_varm(ncid,varid,start,edges,stride,map,value,memtype);
544 }
545  /* All these functions are part of this named group... */
550 
625 int
626 nc_get_vara(int ncid, int varid, const size_t *startp,
627  const size_t *countp, void *ip)
628 {
629  NC* ncp = NULL;
630  nc_type xtype = NC_NAT;
631  int stat = NC_check_id(ncid, &ncp);
632  if(stat != NC_NOERR) return stat;
633  stat = nc_inq_vartype(ncid, varid, &xtype);
634  if(stat != NC_NOERR) return stat;
635  return NC_get_vara(ncid, varid, startp, countp, ip, xtype);
636 }
637 
638 int
639 nc_get_vara_text(int ncid, int varid, const size_t *startp,
640  const size_t *countp, char *ip)
641 {
642  NC* ncp;
643  int stat = NC_check_id(ncid, &ncp);
644  if(stat != NC_NOERR) return stat;
645  return NC_get_vara(ncid, varid, startp, countp,
646  (void *)ip, NC_CHAR);
647 }
648 
649 int
650 nc_get_vara_schar(int ncid, int varid, const size_t *startp,
651  const size_t *countp, signed char *ip)
652 {
653  NC* ncp;
654  int stat = NC_check_id(ncid, &ncp);
655  if(stat != NC_NOERR) return stat;
656  return NC_get_vara(ncid, varid, startp, countp,
657  (void *)ip, NC_BYTE);
658 }
659 
660 int
661 nc_get_vara_uchar(int ncid, int varid, const size_t *startp,
662  const size_t *countp, unsigned char *ip)
663 {
664  NC* ncp;
665  int stat = NC_check_id(ncid, &ncp);
666  if(stat != NC_NOERR) return stat;
667  return NC_get_vara(ncid, varid, startp, countp,
668  (void *)ip, T_uchar);
669 }
670 
671 int
672 nc_get_vara_short(int ncid, int varid, const size_t *startp,
673  const size_t *countp, short *ip)
674 {
675  NC* ncp;
676  int stat = NC_check_id(ncid, &ncp);
677  if(stat != NC_NOERR) return stat;
678  return NC_get_vara(ncid, varid, startp, countp,
679  (void *)ip, NC_SHORT);
680 }
681 
682 int
683 nc_get_vara_int(int ncid, int varid,
684  const size_t *startp, const size_t *countp, int *ip)
685 {
686  NC* ncp;
687  int stat = NC_check_id(ncid, &ncp);
688  if(stat != NC_NOERR) return stat;
689  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_INT);
690 }
691 
692 int
693 nc_get_vara_long(int ncid, int varid,
694  const size_t *startp, const size_t *countp, long *ip)
695 {
696  NC* ncp;
697  int stat = NC_check_id(ncid, &ncp);
698  if(stat != NC_NOERR) return stat;
699  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_long);
700 }
701 
702 int
703 nc_get_vara_float(int ncid, int varid,
704  const size_t *startp, const size_t *countp, float *ip)
705 {
706  NC* ncp;
707  int stat = NC_check_id(ncid, &ncp);
708  if(stat != NC_NOERR) return stat;
709  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_float);
710 }
711 
712 
713 int
714 nc_get_vara_double(int ncid, int varid, const size_t *startp,
715  const size_t *countp, double *ip)
716 {
717  NC* ncp;
718  int stat = NC_check_id(ncid, &ncp);
719  if(stat != NC_NOERR) return stat;
720  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_double);
721 }
722 
723 int
724 nc_get_vara_ubyte(int ncid, int varid,
725  const size_t *startp, const size_t *countp, unsigned char *ip)
726 {
727  NC* ncp;
728  int stat = NC_check_id(ncid, &ncp);
729  if(stat != NC_NOERR) return stat;
730  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_ubyte);
731 }
732 
733 int
734 nc_get_vara_ushort(int ncid, int varid,
735  const size_t *startp, const size_t *countp, unsigned short *ip)
736 {
737  NC* ncp;
738  int stat = NC_check_id(ncid, &ncp);
739  if(stat != NC_NOERR) return stat;
740  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_ushort);
741 }
742 
743 int
744 nc_get_vara_uint(int ncid, int varid,
745  const size_t *startp, const size_t *countp, unsigned int *ip)
746 {
747  NC* ncp;
748  int stat = NC_check_id(ncid, &ncp);
749  if(stat != NC_NOERR) return stat;
750  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_uint);
751 }
752 
753 int
754 nc_get_vara_longlong(int ncid, int varid,
755  const size_t *startp, const size_t *countp, long long *ip)
756 {
757  NC* ncp;
758  int stat = NC_check_id(ncid, &ncp);
759  if(stat != NC_NOERR) return stat;
760  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_longlong);
761 }
762 
763 int
764 nc_get_vara_ulonglong(int ncid, int varid,
765  const size_t *startp, const size_t *countp, unsigned long long *ip)
766 {
767  NC* ncp;
768  int stat = NC_check_id(ncid, &ncp);
769  if(stat != NC_NOERR) return stat;
770  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_UINT64);
771 }
772 
773 #ifdef USE_NETCDF4
774 int
775 nc_get_vara_string(int ncid, int varid,
776  const size_t *startp, const size_t *countp, char* *ip)
777 {
778  NC* ncp;
779  int stat = NC_check_id(ncid, &ncp);
780  if(stat != NC_NOERR) return stat;
781  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_STRING);
782 }
783 
784 #endif /*USE_NETCDF4*/
785 
821 int
822 nc_get_var1(int ncid, int varid, const size_t *indexp, void *ip)
823 {
824  return NC_get_var1(ncid, varid, indexp, ip, NC_NAT);
825 }
826 
827 int
828 nc_get_var1_text(int ncid, int varid, const size_t *indexp, char *ip)
829 {
830  NC* ncp;
831  int stat = NC_check_id(ncid, &ncp);
832  if(stat != NC_NOERR) return stat;
833  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_CHAR);
834 }
835 
836 int
837 nc_get_var1_schar(int ncid, int varid, const size_t *indexp, signed char *ip)
838 {
839  NC* ncp;
840  int stat = NC_check_id(ncid, &ncp);
841  if(stat != NC_NOERR) return stat;
842  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_BYTE);
843 }
844 
845 int
846 nc_get_var1_uchar(int ncid, int varid, const size_t *indexp, unsigned char *ip)
847 {
848  NC* ncp;
849  int stat = NC_check_id(ncid, &ncp);
850  if(stat != NC_NOERR) return stat;
851  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UBYTE);
852 }
853 
854 int
855 nc_get_var1_short(int ncid, int varid, const size_t *indexp, short *ip)
856 {
857  NC* ncp;
858  int stat = NC_check_id(ncid, &ncp);
859  if(stat != NC_NOERR) return stat;
860  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_SHORT);
861 }
862 
863 int
864 nc_get_var1_int(int ncid, int varid, const size_t *indexp, int *ip)
865 {
866  NC* ncp;
867  int stat = NC_check_id(ncid, &ncp);
868  if(stat != NC_NOERR) return stat;
869  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_INT);
870 }
871 
872 int
873 nc_get_var1_long(int ncid, int varid, const size_t *indexp,
874  long *ip)
875 {
876  NC* ncp;
877  int stat = NC_check_id(ncid, &ncp);
878  if(stat != NC_NOERR) return stat;
879  return NC_get_var1(ncid, varid, indexp, (void *)ip, longtype);
880 }
881 
882 int
883 nc_get_var1_float(int ncid, int varid, const size_t *indexp,
884  float *ip)
885 {
886  NC* ncp;
887  int stat = NC_check_id(ncid, &ncp);
888  if(stat != NC_NOERR) return stat;
889  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_FLOAT);
890 }
891 
892 int
893 nc_get_var1_double(int ncid, int varid, const size_t *indexp,
894  double *ip)
895 {
896  NC* ncp;
897  int stat = NC_check_id(ncid, &ncp);
898  if(stat != NC_NOERR) return stat;
899  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_DOUBLE);
900 }
901 
902 int
903 nc_get_var1_ubyte(int ncid, int varid, const size_t *indexp,
904  unsigned char *ip)
905 {
906  NC* ncp;
907  int stat = NC_check_id(ncid, &ncp);
908  if(stat != NC_NOERR) return stat;
909  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UBYTE);
910 }
911 
912 int
913 nc_get_var1_ushort(int ncid, int varid, const size_t *indexp,
914  unsigned short *ip)
915 {
916  NC* ncp;
917  int stat = NC_check_id(ncid, &ncp);
918  if(stat != NC_NOERR) return stat;
919  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_USHORT);
920 }
921 
922 int
923 nc_get_var1_uint(int ncid, int varid, const size_t *indexp,
924  unsigned int *ip)
925 {
926  NC* ncp;
927  int stat = NC_check_id(ncid, &ncp);
928  if(stat != NC_NOERR) return stat;
929  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UINT);
930 }
931 
932 int
933 nc_get_var1_longlong(int ncid, int varid, const size_t *indexp,
934  long long *ip)
935 {
936  NC* ncp;
937  int stat = NC_check_id(ncid, &ncp);
938  if(stat != NC_NOERR) return stat;
939  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_INT64);
940 }
941 
942 int
943 nc_get_var1_ulonglong(int ncid, int varid, const size_t *indexp,
944  unsigned long long *ip)
945 {
946  NC* ncp;
947  int stat = NC_check_id(ncid, &ncp);
948  if(stat != NC_NOERR) return stat;
949  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UINT64);
950 }
951 
952 #ifdef USE_NETCDF4
953 int
954 nc_get_var1_string(int ncid, int varid, const size_t *indexp, char* *ip)
955 {
956  NC* ncp;
957  int stat = NC_check_id(ncid, &ncp);
958  if(stat != NC_NOERR) return stat;
959  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_STRING);
960 }
961 #endif /*USE_NETCDF4*/
962 
1007 int
1008 nc_get_var(int ncid, int varid, void *ip)
1009 {
1010  return NC_get_var(ncid, varid, ip, NC_NAT);
1011 }
1012 
1013 int
1014 nc_get_var_text(int ncid, int varid, char *ip)
1015 {
1016  NC *ncp;
1017  int stat = NC_check_id(ncid, &ncp);
1018  if(stat != NC_NOERR) return stat;
1019  return NC_get_var(ncid, varid, (void *)ip, NC_CHAR);
1020 }
1021 
1022 int
1023 nc_get_var_schar(int ncid, int varid, signed char *ip)
1024 {
1025  NC *ncp;
1026  int stat = NC_check_id(ncid, &ncp);
1027  if(stat != NC_NOERR) return stat;
1028  return NC_get_var(ncid, varid, (void *)ip, NC_BYTE);
1029 }
1030 
1031 int
1032 nc_get_var_uchar(int ncid, int varid, unsigned char *ip)
1033 {
1034  NC *ncp;
1035  int stat = NC_check_id(ncid, &ncp);
1036  if(stat != NC_NOERR) return stat;
1037  return NC_get_var(ncid,varid, (void *)ip, NC_UBYTE);
1038 }
1039 
1040 int
1041 nc_get_var_short(int ncid, int varid, short *ip)
1042 {
1043  NC* ncp;
1044  int stat = NC_check_id(ncid, &ncp);
1045  if(stat != NC_NOERR) return stat;
1046  return NC_get_var(ncid, varid, (void *)ip, NC_SHORT);
1047 }
1048 
1049 int
1050 nc_get_var_int(int ncid, int varid, int *ip)
1051 {
1052  NC* ncp;
1053  int stat = NC_check_id(ncid, &ncp);
1054  if(stat != NC_NOERR) return stat;
1055  return NC_get_var(ncid,varid, (void *)ip, NC_INT);
1056 }
1057 
1058 int
1059 nc_get_var_long(int ncid, int varid, long *ip)
1060 {
1061  NC* ncp;
1062  int stat = NC_check_id(ncid, &ncp);
1063  if(stat != NC_NOERR) return stat;
1064  return NC_get_var(ncid,varid, (void *)ip, longtype);
1065 }
1066 
1067 int
1068 nc_get_var_float(int ncid, int varid, float *ip)
1069 {
1070  NC* ncp;
1071  int stat = NC_check_id(ncid, &ncp);
1072  if(stat != NC_NOERR) return stat;
1073  return NC_get_var(ncid,varid, (void *)ip, NC_FLOAT);
1074 }
1075 
1076 int
1077 nc_get_var_double(int ncid, int varid, double *ip)
1078 {
1079  NC* ncp;
1080  int stat = NC_check_id(ncid, &ncp);
1081  if(stat != NC_NOERR) return stat;
1082  return NC_get_var(ncid,varid, (void *)ip, NC_DOUBLE);
1083 }
1084 
1085 int
1086 nc_get_var_ubyte(int ncid, int varid, unsigned char *ip)
1087 {
1088  NC* ncp;
1089  int stat = NC_check_id(ncid, &ncp);
1090  if(stat != NC_NOERR) return stat;
1091  return NC_get_var(ncid,varid, (void *)ip, NC_UBYTE);
1092 }
1093 
1094 int
1095 nc_get_var_ushort(int ncid, int varid, unsigned short *ip)
1096 {
1097  NC* ncp;
1098  int stat = NC_check_id(ncid, &ncp);
1099  if(stat != NC_NOERR) return stat;
1100  return NC_get_var(ncid,varid, (void *)ip, NC_USHORT);
1101 }
1102 
1103 int
1104 nc_get_var_uint(int ncid, int varid, unsigned int *ip)
1105 {
1106  NC* ncp;
1107  int stat = NC_check_id(ncid, &ncp);
1108  if(stat != NC_NOERR) return stat;
1109  return NC_get_var(ncid,varid, (void *)ip, NC_UINT);
1110 }
1111 
1112 int
1113 nc_get_var_longlong(int ncid, int varid, long long *ip)
1114 {
1115  NC* ncp;
1116  int stat = NC_check_id(ncid, &ncp);
1117  if(stat != NC_NOERR) return stat;
1118  return NC_get_var(ncid,varid, (void *)ip, NC_INT64);
1119 }
1120 
1121 int
1122 nc_get_var_ulonglong(int ncid, int varid, unsigned long long *ip)
1123 {
1124  NC* ncp;
1125  int stat = NC_check_id(ncid, &ncp);
1126  if(stat != NC_NOERR) return stat;
1127  return NC_get_var(ncid,varid, (void *)ip,NC_UINT64);
1128 }
1129 
1130 #ifdef USE_NETCDF4
1131 int
1132 nc_get_var_string(int ncid, int varid, char* *ip)
1133 {
1134  NC* ncp;
1135  int stat = NC_check_id(ncid, &ncp);
1136  if(stat != NC_NOERR) return stat;
1137  return NC_get_var(ncid,varid, (void *)ip,NC_STRING);
1138 }
1139 #endif /*USE_NETCDF4*/
1140 
1182 int
1183 nc_get_vars (int ncid, int varid, const size_t * startp,
1184  const size_t * countp, const ptrdiff_t * stridep,
1185  void *ip)
1186 {
1187  NC* ncp;
1188  int stat = NC_NOERR;
1189 
1190  if ((stat = NC_check_id(ncid, &ncp)))
1191  return stat;
1192  return ncp->dispatch->get_vars(ncid, varid, startp, countp, stridep,
1193  ip, NC_NAT);
1194 }
1195 
1196 int
1197 nc_get_vars_text(int ncid, int varid, const size_t *startp,
1198  const size_t *countp, const ptrdiff_t * stridep,
1199  char *ip)
1200 {
1201  NC* ncp;
1202  int stat = NC_check_id(ncid, &ncp);
1203  if(stat != NC_NOERR) return stat;
1204  return NC_get_vars(ncid,varid,startp, countp, stridep,
1205  (void *)ip, NC_CHAR);
1206 }
1207 
1208 int
1209 nc_get_vars_schar(int ncid, int varid, const size_t *startp,
1210  const size_t *countp, const ptrdiff_t * stridep,
1211  signed char *ip)
1212 {
1213  NC* ncp;
1214  int stat = NC_check_id(ncid, &ncp);
1215  if(stat != NC_NOERR) return stat;
1216  return NC_get_vars(ncid,varid,startp, countp, stridep,
1217  (void *)ip, NC_BYTE);
1218 }
1219 
1220 int
1221 nc_get_vars_uchar(int ncid, int varid, const size_t *startp,
1222  const size_t *countp, const ptrdiff_t * stridep,
1223  unsigned char *ip)
1224 {
1225  NC* ncp;
1226  int stat = NC_check_id(ncid, &ncp);
1227  if(stat != NC_NOERR) return stat;
1228  return NC_get_vars(ncid,varid,startp, countp, stridep,
1229  (void *)ip, T_uchar);
1230 }
1231 
1232 int
1233 nc_get_vars_short(int ncid, int varid, const size_t *startp,
1234  const size_t *countp, const ptrdiff_t *stridep,
1235  short *ip)
1236 {
1237  NC* ncp;
1238  int stat = NC_check_id(ncid, &ncp);
1239  if(stat != NC_NOERR) return stat;
1240  return NC_get_vars(ncid,varid,startp, countp, stridep,
1241  (void *)ip, NC_SHORT);
1242 }
1243 
1244 int
1245 nc_get_vars_int(int ncid, int varid, const size_t *startp,
1246  const size_t *countp, const ptrdiff_t * stridep,
1247  int *ip)
1248 {
1249  NC* ncp;
1250  int stat = NC_check_id(ncid, &ncp);
1251  if(stat != NC_NOERR) return stat;
1252  return NC_get_vars(ncid,varid,startp, countp, stridep,
1253  (void *)ip, NC_INT);
1254 }
1255 
1256 int
1257 nc_get_vars_long(int ncid, int varid, const size_t *startp,
1258  const size_t *countp, const ptrdiff_t * stridep,
1259  long *ip)
1260 {
1261  NC* ncp;
1262  int stat = NC_check_id(ncid, &ncp);
1263  if(stat != NC_NOERR) return stat;
1264  return NC_get_vars(ncid,varid,startp, countp, stridep,
1265  (void *)ip, T_long);
1266 }
1267 
1268 int
1269 nc_get_vars_float(int ncid, int varid, const size_t *startp,
1270  const size_t *countp, const ptrdiff_t * stridep,
1271  float *ip)
1272 {
1273  NC* ncp;
1274  int stat = NC_check_id(ncid, &ncp);
1275  if(stat != NC_NOERR) return stat;
1276  return NC_get_vars(ncid,varid,startp, countp, stridep,
1277  (void *)ip, T_float);
1278 }
1279 
1280 int
1281 nc_get_vars_double(int ncid, int varid, const size_t *startp,
1282  const size_t *countp, const ptrdiff_t * stridep,
1283  double *ip)
1284 {
1285  NC* ncp;
1286  int stat = NC_check_id(ncid, &ncp);
1287  if(stat != NC_NOERR) return stat;
1288  return NC_get_vars(ncid,varid,startp, countp, stridep,
1289  (void *)ip, T_double);
1290 }
1291 
1292 int
1293 nc_get_vars_ubyte(int ncid, int varid, const size_t *startp,
1294  const size_t *countp, const ptrdiff_t * stridep,
1295  unsigned char *ip)
1296 {
1297  NC* ncp;
1298  int stat = NC_check_id(ncid, &ncp);
1299  if(stat != NC_NOERR) return stat;
1300  return NC_get_vars(ncid,varid, startp, countp, stridep,
1301  (void *)ip, T_ubyte);
1302 }
1303 
1304 int
1305 nc_get_vars_ushort(int ncid, int varid, const size_t *startp,
1306  const size_t *countp, const ptrdiff_t * stridep,
1307  unsigned short *ip)
1308 {
1309  NC* ncp;
1310  int stat = NC_check_id(ncid, &ncp);
1311  if(stat != NC_NOERR) return stat;
1312  return NC_get_vars(ncid,varid,startp,countp, stridep,
1313  (void *)ip, T_ushort);
1314 }
1315 
1316 int
1317 nc_get_vars_uint(int ncid, int varid, const size_t *startp,
1318  const size_t *countp, const ptrdiff_t * stridep,
1319  unsigned int *ip)
1320 {
1321  NC* ncp;
1322  int stat = NC_check_id(ncid, &ncp);
1323  if(stat != NC_NOERR) return stat;
1324  return NC_get_vars(ncid,varid,startp, countp, stridep,
1325  (void *)ip, T_uint);
1326 }
1327 
1328 int
1329 nc_get_vars_longlong(int ncid, int varid, const size_t *startp,
1330  const size_t *countp, const ptrdiff_t * stridep,
1331  long long *ip)
1332 {
1333  NC* ncp;
1334  int stat = NC_check_id(ncid, &ncp);
1335  if(stat != NC_NOERR) return stat;
1336  return NC_get_vars(ncid, varid, startp, countp, stridep,
1337  (void *)ip, T_longlong);
1338 }
1339 
1340 int
1341 nc_get_vars_ulonglong(int ncid, int varid, const size_t *startp,
1342  const size_t *countp, const ptrdiff_t * stridep,
1343  unsigned long long *ip)
1344 {
1345  NC* ncp;
1346  int stat = NC_check_id(ncid, &ncp);
1347  if(stat != NC_NOERR) return stat;
1348  return NC_get_vars(ncid, varid, startp, countp, stridep,
1349  (void *)ip, NC_UINT64);
1350 }
1351 
1352 #ifdef USE_NETCDF4
1353 int
1354 nc_get_vars_string(int ncid, int varid,
1355  const size_t *startp, const size_t *countp,
1356  const ptrdiff_t * stridep,
1357  char* *ip)
1358 {
1359  NC* ncp;
1360  int stat = NC_check_id(ncid, &ncp);
1361  if(stat != NC_NOERR) return stat;
1362  return NC_get_vars(ncid, varid, startp, countp, stridep,
1363  (void *)ip, NC_STRING);
1364 }
1365 #endif /*USE_NETCDF4*/
1366 
1423 int
1424 nc_get_varm(int ncid, int varid, const size_t * startp,
1425  const size_t * countp, const ptrdiff_t * stridep,
1426  const ptrdiff_t * imapp, void *ip)
1427 {
1428  NC* ncp;
1429  int stat = NC_NOERR;
1430 
1431  if ((stat = NC_check_id(ncid, &ncp)))
1432  return stat;
1433  return ncp->dispatch->get_varm(ncid, varid, startp, countp,
1434  stridep, imapp, ip, NC_NAT);
1435 }
1436 
1437 int
1438 nc_get_varm_schar(int ncid, int varid,
1439  const size_t *startp, const size_t *countp,
1440  const ptrdiff_t *stridep,
1441  const ptrdiff_t *imapp, signed char *ip)
1442 {
1443  NC *ncp;
1444  int stat = NC_check_id(ncid, &ncp);
1445  if(stat != NC_NOERR) return stat;
1446  return NC_get_varm(ncid, varid, startp, countp,
1447  stridep, imapp, (void *)ip, NC_BYTE);
1448 }
1449 
1450 int
1451 nc_get_varm_uchar(int ncid, int varid,
1452  const size_t *startp, const size_t *countp,
1453  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1454  unsigned char *ip)
1455 {
1456  NC *ncp;
1457  int stat = NC_check_id(ncid, &ncp);
1458  if(stat != NC_NOERR) return stat;
1459  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_uchar);
1460 }
1461 
1462 int
1463 nc_get_varm_short(int ncid, int varid, const size_t *startp,
1464  const size_t *countp, const ptrdiff_t *stridep,
1465  const ptrdiff_t *imapp, short *ip)
1466 {
1467  NC *ncp;
1468  int stat = NC_check_id(ncid, &ncp);
1469  if(stat != NC_NOERR) return stat;
1470  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,NC_SHORT);
1471 }
1472 
1473 int
1474 nc_get_varm_int(int ncid, int varid,
1475  const size_t *startp, const size_t *countp,
1476  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1477  int *ip)
1478 {
1479  NC *ncp;
1480  int stat = NC_check_id(ncid, &ncp);
1481  if(stat != NC_NOERR) return stat;
1482  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,NC_INT);
1483 }
1484 
1485 int
1486 nc_get_varm_long(int ncid, int varid,
1487  const size_t *startp, const size_t *countp,
1488  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1489  long *ip)
1490 {
1491  NC *ncp;
1492  int stat = NC_check_id(ncid, &ncp);
1493  if(stat != NC_NOERR) return stat;
1494  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_long);
1495 }
1496 
1497 int
1498 nc_get_varm_float(int ncid, int varid,
1499  const size_t *startp, const size_t *countp,
1500  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1501  float *ip)
1502 {
1503  NC *ncp;
1504  int stat = NC_check_id(ncid, &ncp);
1505  if(stat != NC_NOERR) return stat;
1506  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_float);
1507 }
1508 
1509 int
1510 nc_get_varm_double(int ncid, int varid,
1511  const size_t *startp, const size_t *countp,
1512  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1513  double *ip)
1514 {
1515  NC *ncp;
1516  int stat = NC_check_id(ncid, &ncp);
1517  if(stat != NC_NOERR) return stat;
1518  return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_double);
1519 }
1520 
1521 int
1522 nc_get_varm_ubyte(int ncid, int varid,
1523  const size_t *startp, const size_t *countp,
1524  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1525  unsigned char *ip)
1526 {
1527  NC *ncp;
1528  int stat = NC_check_id(ncid, &ncp);
1529  if(stat != NC_NOERR) return stat;
1530  return NC_get_varm(ncid,varid,startp,countp,stridep,
1531  imapp, (void *)ip, T_ubyte);
1532 }
1533 
1534 int
1535 nc_get_varm_ushort(int ncid, int varid,
1536  const size_t *startp, const size_t *countp,
1537  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1538  unsigned short *ip)
1539 {
1540  NC *ncp;
1541  int stat = NC_check_id(ncid, &ncp);
1542  if(stat != NC_NOERR) return stat;
1543  return NC_get_varm(ncid, varid, startp, countp, stridep,
1544  imapp, (void *)ip, T_ushort);
1545 }
1546 
1547 int
1548 nc_get_varm_uint(int ncid, int varid,
1549  const size_t *startp, const size_t *countp,
1550  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1551  unsigned int *ip)
1552 {
1553  NC *ncp;
1554  int stat = NC_check_id(ncid, &ncp);
1555  if(stat != NC_NOERR) return stat;
1556  return NC_get_varm(ncid, varid, startp, countp,
1557  stridep, imapp, (void *)ip, T_uint);
1558 }
1559 
1560 int
1561 nc_get_varm_longlong(int ncid, int varid, const size_t *startp,
1562  const size_t *countp, const ptrdiff_t *stridep,
1563  const ptrdiff_t *imapp, long long *ip)
1564 {
1565  NC *ncp;
1566  int stat = NC_check_id(ncid, &ncp);
1567  if(stat != NC_NOERR) return stat;
1568  return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1569  (void *)ip, T_longlong);
1570 }
1571 
1572 int
1573 nc_get_varm_ulonglong(int ncid, int varid,
1574  const size_t *startp, const size_t *countp,
1575  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1576  unsigned long long *ip)
1577 {
1578  NC *ncp;
1579  int stat = NC_check_id(ncid, &ncp);
1580  if(stat != NC_NOERR) return stat;
1581  return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1582  (void *)ip, NC_UINT64);
1583 }
1584 
1585 int
1586 nc_get_varm_text(int ncid, int varid, const size_t *startp,
1587  const size_t *countp, const ptrdiff_t *stridep,
1588  const ptrdiff_t *imapp, char *ip)
1589 {
1590  NC *ncp;
1591  int stat = NC_check_id(ncid, &ncp);
1592  if(stat != NC_NOERR) return stat;
1593  return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1594  (void *)ip, NC_CHAR);
1595 }
1596 
1597 #ifdef USE_NETCDF4
1598 int
1599 nc_get_varm_string(int ncid, int varid, const size_t *startp,
1600  const size_t *countp, const ptrdiff_t *stridep,
1601  const ptrdiff_t *imapp, char **ip)
1602 {
1603  NC *ncp;
1604  int stat = NC_check_id(ncid, &ncp);
1605  if(stat != NC_NOERR) return stat;
1606  return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1607  (void *)ip, NC_STRING);
1608 }
1610 #endif /*USE_NETCDF4*/
1611 
1612  /* 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:744
int nc_get_var_uint(int ncid, int varid, unsigned int *ip)
Read an entire variable in one call.
Definition: dvarget.c:1104
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:828
#define NC_ENOMEM
Memory allocation (malloc) failure.
Definition: netcdf.h:395
int nc_get_var_ulonglong(int ncid, int varid, unsigned long long *ip)
Read an entire variable in one call.
Definition: dvarget.c:1122
#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:1463
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:1522
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:714
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:1498
#define NC_UBYTE
unsigned 1 byte int
Definition: netcdf.h:45
#define NC_EMAPTYPE
Mapped access for atomic types only.
Definition: netcdf.h:448
#define NC_ERANGE
Math result not representable.
Definition: netcdf.h:394
#define NC_MAX_VAR_DIMS
max per variable dimensions
Definition: netcdf.h:269
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:1197
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:1293
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:954
#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:1059
#define NC_EINVALCOORDS
Index exceeds dimension bound.
Definition: netcdf.h:347
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:1438
#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:1281
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:1023
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:1424
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:775
#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:933
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:1474
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:1329
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:734
int nc_get_var(int ncid, int varid, void *ip)
Read an entire variable in one call.
Definition: dvarget.c:1008
int nc_get_var_int(int ncid, int varid, int *ip)
Read an entire variable in one call.
Definition: dvarget.c:1050
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:672
int nc_get_var_ushort(int ncid, int varid, unsigned short *ip)
Read an entire variable in one call.
Definition: dvarget.c:1095
int nc_get_var_double(int ncid, int varid, double *ip)
Read an entire variable in one call.
Definition: dvarget.c:1077
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:703
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:1548
int nc_get_var_string(int ncid, int varid, char **ip)
Read an entire variable in one call.
Definition: dvarget.c:1132
#define NC_EBADTYPE
Not a netcdf data type.
Definition: netcdf.h:357
#define NC_EEDGE
Start+count exceeds dimension bound.
Definition: netcdf.h:385
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:903
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:846
int nc_get_var1(int ncid, int varid, const size_t *indexp, void *ip)
Read a single datum from a variable.
Definition: dvarget.c:822
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:683
#define NC_ESTRIDE
Illegal stride.
Definition: netcdf.h:386
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:923
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:754
#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:764
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:1221
int nc_get_var_text(int ncid, int varid, char *ip)
Read an entire variable in one call.
Definition: dvarget.c:1014
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:1451
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:1341
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:1245
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:724
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:883
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:639
#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:650
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:1269
EXTERNL int nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size)
Inquire about a type.
Definition: dfile.c:1537
#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:1086
int nc_get_var_longlong(int ncid, int varid, long long *ip)
Read an entire variable in one call.
Definition: dvarget.c:1113
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:1233
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:913
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:1586
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:837
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:1209
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:1257
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:1305
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:661
int nc_get_var_float(int ncid, int varid, float *ip)
Read an entire variable in one call.
Definition: dvarget.c:1068
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:855
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:1183
int nc_get_var_short(int ncid, int varid, short *ip)
Read an entire variable in one call.
Definition: dvarget.c:1041
#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:943
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:893
int nc_get_var_uchar(int ncid, int varid, unsigned char *ip)
Read an entire variable in one call.
Definition: dvarget.c:1032
#define NC_NOERR
No Error.
Definition: netcdf.h:315
#define NC_ECHAR
Attempt to convert between text & numbers.
Definition: netcdf.h:376
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:873
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:1486
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:864
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:1535
#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:1599
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:1510
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:626
#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:693
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:1561
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:1354
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:1317
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:1573

Return to the Main Unidata NetCDF page.
Generated on Thu Jan 21 2016 19:12:45 for NetCDF. NetCDF is a Unidata library.