NetCDF  4.3.2
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
dvarget.c
Go to the documentation of this file.
1 
7 #include "ncdispatch.h"
8 
9 #undef VARS_USES_VARM
10 #ifndef VARS_USES_VARM
11 struct GETodometer {
12  int rank;
13  size_t index[NC_MAX_VAR_DIMS];
14  size_t start[NC_MAX_VAR_DIMS];
15  size_t edges[NC_MAX_VAR_DIMS];
16  ptrdiff_t stride[NC_MAX_VAR_DIMS];
17  size_t stop[NC_MAX_VAR_DIMS];
18 };
19 
20 static void
21 odom_init(struct GETodometer* odom,
22  int rank,
23  const size_t* start, const size_t* edges, const ptrdiff_t* stride)
24 {
25  int i;
26  memset(odom,0,sizeof(struct GETodometer));
27  odom->rank = rank;
28  assert(odom->rank <= NC_MAX_VAR_DIMS);
29  for(i=0;i<odom->rank;i++) {
30  odom->start[i] = (start != NULL ? start[i] : 0);
31  odom->edges[i] = (edges != NULL ? edges[i] : 1);
32  odom->stride[i] = (stride != NULL ? stride[i] : 1);
33  odom->stop[i] = odom->start[i] + (odom->edges[i]*((size_t)odom->stride[i]));
34  odom->index[i] = odom->start[i];
35  }
36 }
37 
38 static int
39 odom_more(struct GETodometer* odom)
40 {
41  return (odom->index[0] < odom->stop[0]);
42 }
43 
44 static int
45 odom_next(struct GETodometer* odom)
46 {
47  int i;
48  if(odom->rank == 0) return 0;
49  for(i=odom->rank-1;i>=0;i--) {
50  odom->index[i] += (size_t)odom->stride[i];
51  if(odom->index[i] < odom->stop[i]) break;
52  if(i == 0) return 0; /* leave the 0th entry if it overflows*/
53  odom->index[i] = odom->start[i]; /* reset this position*/
54  }
55  return 1;
56 }
57 #endif
58 
63 int
64 NC_get_vara(int ncid, int varid,
65  const size_t *start, const size_t *edges,
66  void *value, nc_type memtype)
67 {
68  NC* ncp;
69  int stat = NC_check_id(ncid, &ncp);
70  if(stat != NC_NOERR) return stat;
71 #ifdef USE_NETCDF4
72  if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
73 #endif
74 
75  if(edges == NULL) {
76  size_t shape[NC_MAX_VAR_DIMS];
77  int ndims;
78  stat = nc_inq_varndims(ncid, varid, &ndims);
79  if(stat != NC_NOERR) return stat;
80  stat = NC_getshape(ncid,varid,ndims,shape);
81  if(stat != NC_NOERR) return stat;
82  stat = ncp->dispatch->get_vara(ncid,varid,start,shape,value,memtype);
83  } else
84  stat = ncp->dispatch->get_vara(ncid,varid,start,edges,value,memtype);
85  return stat;
86 }
87 
91 static int
92 NC_get_var(int ncid, int varid, void *value, nc_type memtype)
93 {
94  int ndims;
95  size_t shape[NC_MAX_VAR_DIMS];
96  int stat = nc_inq_varndims(ncid,varid, &ndims);
97  if(stat) return stat;
98  stat = NC_getshape(ncid,varid, ndims, shape);
99  if(stat) return stat;
100  return NC_get_vara(ncid, varid, NC_coord_zero, shape, value, memtype);
101 }
102 
107 int
108 NCDEFAULT_get_vars(int ncid, int varid, const size_t * start,
109  const size_t * edges, const ptrdiff_t * stride,
110  void *value0, nc_type memtype)
111 {
112 #ifdef VARS_USES_VARM
113  NC* ncp;
114  int stat = NC_check_id(ncid, &ncp);
115 
116  if(stat != NC_NOERR) return stat;
117  return ncp->dispatch->get_varm(ncid,varid,start,edges,stride,NULL,value0,memtype);
118 #else
119  /* Rebuilt get_vars code to simplify and avoid use of get_varm */
120 
121  int status = NC_NOERR;
122  int i,simplestride,isrecvar;
123  int rank;
124  struct GETodometer odom;
125  nc_type vartype = NC_NAT;
126  NC* ncp;
127  int memtypelen;
128  size_t vartypelen;
129  char* value = (char*)value0;
130  size_t numrecs;
131  size_t varshape[NC_MAX_VAR_DIMS];
132  size_t mystart[NC_MAX_VAR_DIMS];
133  size_t myedges[NC_MAX_VAR_DIMS];
134  ptrdiff_t mystride[NC_MAX_VAR_DIMS];
135  char *memptr = NULL;
136 
137  status = NC_check_id (ncid, &ncp);
138  if(status != NC_NOERR) return status;
139 
140  status = nc_inq_vartype(ncid, varid, &vartype);
141  if(status != NC_NOERR) return status;
142 
143  if(memtype == NC_NAT) memtype = vartype;
144 
145  /* compute the variable type size */
146  status = nc_inq_type(ncid,vartype,NULL,&vartypelen);
147  if(status != NC_NOERR) return status;
148 
149  if(memtype > NC_MAX_ATOMIC_TYPE)
150  memtypelen = (int)vartypelen;
151  else
152  memtypelen = nctypelen(memtype);
153 
154  /* Check gross internal/external type compatibility */
155  if(vartype != memtype) {
156  /* If !atomic, the two types must be the same */
157  if(vartype > NC_MAX_ATOMIC_TYPE
158  || memtype > NC_MAX_ATOMIC_TYPE)
159  return NC_EBADTYPE;
160  /* ok, the types differ but both are atomic */
161  if(memtype == NC_CHAR || vartype == NC_CHAR)
162  return NC_ECHAR;
163  }
164 
165  /* Get the variable rank */
166  status = nc_inq_varndims(ncid, varid, &rank);
167  if(status != NC_NOERR) return status;
168 
169  /* Get variable dimension sizes */
170  isrecvar = NC_is_recvar(ncid,varid,&numrecs);
171  NC_getshape(ncid,varid,rank,varshape);
172 
173  /* Optimize out using various checks */
174  if (rank == 0) {
175  /*
176  * The variable is a scalar; consequently,
177  * there s only one thing to get and only one place to put it.
178  * (Why was I called?)
179  */
180  size_t edge1[1] = {1};
181  return NC_get_vara(ncid, varid, start, edge1, value, memtype);
182  }
183 
184  /* Do various checks and fixups on start/edges/stride */
185  simplestride = 1; /* assume so */
186  for(i=0;i<rank;i++) {
187  size_t dimlen;
188  mystart[i] = (start == NULL ? 0 : start[i]);
189  if(edges == NULL) {
190  if(i == 0 && isrecvar)
191  myedges[i] = numrecs - start[i];
192  else
193  myedges[i] = varshape[i] - mystart[i];
194  } else
195  myedges[i] = edges[i];
196  if(myedges[i] == 0)
197  return NC_NOERR; /* cannot read anything */
198  mystride[i] = (stride == NULL ? 1 : stride[i]);
199  if(mystride[i] <= 0
200  /* cast needed for braindead systems with signed size_t */
201  || ((unsigned long) mystride[i] >= X_INT_MAX))
202  return NC_ESTRIDE;
203  if(mystride[i] != 1) simplestride = 0;
204  /* illegal value checks */
205  dimlen = (i == 0 && isrecvar ? numrecs : varshape[i]);
206  /* mystart is unsigned, never < 0 */
207  //if(mystart[i] < 0 || mystart[i] >= dimlen)
208  if(mystart[i] >= dimlen)
209  return NC_EINVALCOORDS;
210  /* myedges is unsigned, never < 0 */
211  //if(myedges[i] < 0 || (mystart[i] + myedges[i] > dimlen))
212  if(mystart[i] + myedges[i] > dimlen)
213  return NC_EEDGE;
214  }
215  if(simplestride) {
216  return NC_get_vara(ncid, varid, mystart, myedges, value, memtype);
217  }
218 
219  /* memptr indicates where to store the next value */
220  memptr = value;
221 
222  odom_init(&odom,rank,mystart,myedges,mystride);
223 
224  /* walk the odometer to extract values */
225  while(odom_more(&odom)) {
226  int localstatus = NC_NOERR;
227  /* Read a single value */
228  localstatus = NC_get_vara(ncid,varid,odom.index,nc_sizevector1,memptr,memtype);
229  /* So it turns out that when get_varm is used, all errors are
230  delayed and ERANGE will be overwritten by more serious errors.
231  */
232  if(localstatus != NC_NOERR) {
233  if(status == NC_NOERR || localstatus != NC_ERANGE)
234  status = localstatus;
235  }
236  memptr += memtypelen;
237  odom_next(&odom);
238  }
239  return status;
240 #endif
241 }
242 
246 static int
247 NC_get_var1(int ncid, int varid, const size_t *coord, void* value,
248  nc_type memtype)
249 {
250  return NC_get_vara(ncid, varid, coord, NC_coord_one, value, memtype);
251 }
252 
256 int
257 NCDEFAULT_get_varm(int ncid, int varid, const size_t *start,
258  const size_t *edges, const ptrdiff_t *stride,
259  const ptrdiff_t *imapp, void *value0, nc_type memtype)
260 {
261  int status = NC_NOERR;
262  nc_type vartype = NC_NAT;
263  int varndims,maxidim;
264  NC* ncp;
265  int memtypelen;
266  ptrdiff_t cvtmap[NC_MAX_VAR_DIMS];
267  char* value = (char*)value0;
268 
269  status = NC_check_id (ncid, &ncp);
270  if(status != NC_NOERR) return status;
271 
272 /*
273  if(NC_indef(ncp)) return NC_EINDEFINE;
274 */
275 
276  status = nc_inq_vartype(ncid, varid, &vartype);
277  if(status != NC_NOERR) return status;
278  /* Check that this is an atomic type */
279  if(vartype > NC_MAX_ATOMIC_TYPE)
280  return NC_EMAPTYPE;
281 
282  status = nc_inq_varndims(ncid, varid, &varndims);
283  if(status != NC_NOERR) return status;
284 
285  if(memtype == NC_NAT) {
286  if(imapp != NULL && varndims != 0) {
287  /*
288  * convert map units from bytes to units of sizeof(type)
289  */
290  size_t ii;
291  const ptrdiff_t szof = (ptrdiff_t) nctypelen(vartype);
292  for(ii = 0; ii < varndims; ii++) {
293  if(imapp[ii] % szof != 0) {
294  /*free(cvtmap);*/
295  return NC_EINVAL;
296  }
297  cvtmap[ii] = imapp[ii] / szof;
298  }
299  imapp = cvtmap;
300  }
301  memtype = vartype;
302  }
303 
304  if(memtype == NC_CHAR && vartype != NC_CHAR)
305  return NC_ECHAR;
306  else if(memtype != NC_CHAR && vartype == NC_CHAR)
307  return NC_ECHAR;
308 
309  memtypelen = nctypelen(memtype);
310 
311  maxidim = (int) varndims - 1;
312 
313  if (maxidim < 0)
314  {
315  /*
316  * The variable is a scalar; consequently,
317  * there s only one thing to get and only one place to put it.
318  * (Why was I called?)
319  */
320  size_t edge1[1] = {1};
321  return NC_get_vara(ncid, varid, start, edge1, value, memtype);
322  }
323 
324  /*
325  * else
326  * The variable is an array.
327  */
328  {
329  int idim;
330  size_t *mystart = NULL;
331  size_t *myedges;
332  size_t *iocount; /* count vector */
333  size_t *stop; /* stop indexes */
334  size_t *length; /* edge lengths in bytes */
335  ptrdiff_t *mystride;
336  ptrdiff_t *mymap;
337  size_t varshape[NC_MAX_VAR_DIMS];
338  int isrecvar;
339  size_t numrecs;
340 
341  /* Compute some dimension related values */
342  isrecvar = NC_is_recvar(ncid,varid,&numrecs);
343  NC_getshape(ncid,varid,varndims,varshape);
344 
345  /*
346  * Verify stride argument; also see if stride is all ones
347  */
348  if(stride != NULL) {
349  int stride1 = 1;
350  for (idim = 0; idim <= maxidim; ++idim)
351  {
352  if (stride[idim] == 0
353  /* cast needed for braindead systems with signed size_t */
354  || ((unsigned long) stride[idim] >= X_INT_MAX))
355  {
356  return NC_ESTRIDE;
357  }
358  if(stride[idim] != 1) stride1 = 0;
359  }
360  /* If stride1 is true, and there is no imap
361  then call get_vara directly.
362  */
363  if(stride1 && imapp == NULL) {
364  return NC_get_vara(ncid, varid, start, edges, value, memtype);
365  }
366  }
367 
368  /* assert(sizeof(ptrdiff_t) >= sizeof(size_t)); */
369  /* Allocate space for mystart,mystride,mymap etc.all at once */
370  mystart = (size_t *)calloc((size_t)(varndims * 7), sizeof(ptrdiff_t));
371  if(mystart == NULL) return NC_ENOMEM;
372  myedges = mystart + varndims;
373  iocount = myedges + varndims;
374  stop = iocount + varndims;
375  length = stop + varndims;
376  mystride = (ptrdiff_t *)(length + varndims);
377  mymap = mystride + varndims;
378 
379  /*
380  * Initialize I/O parameters.
381  */
382  for (idim = maxidim; idim >= 0; --idim)
383  {
384  mystart[idim] = start != NULL
385  ? start[idim]
386  : 0;
387 
388  if (edges != NULL && edges[idim] == 0)
389  {
390  status = NC_NOERR; /* read/write no data */
391  goto done;
392  }
393 
394 #ifdef COMPLEX
395  myedges[idim] = edges != NULL
396  ? edges[idim]
397  : idim == 0 && isrecvar
398  ? numrecs - mystart[idim]
399  : varshape[idim] - mystart[idim];
400 #else
401  if(edges != NULL)
402  myedges[idim] = edges[idim];
403  else if (idim == 0 && isrecvar)
404  myedges[idim] = numrecs - mystart[idim];
405  else
406  myedges[idim] = varshape[idim] - mystart[idim];
407 #endif
408 
409  mystride[idim] = stride != NULL
410  ? stride[idim]
411  : 1;
412 
413  /* Remember: imapp is byte oriented, not index oriented */
414 #ifdef COMPLEX
415  mymap[idim] = (imapp != NULL
416  ? imapp[idim]
417  : (idim == maxidim ? 1
418  : mymap[idim + 1] * (ptrdiff_t) myedges[idim + 1]));
419 #else
420  if(imapp != NULL)
421  mymap[idim] = imapp[idim];
422  else if (idim == maxidim)
423  mymap[idim] = 1;
424  else
425  mymap[idim] =
426  mymap[idim + 1] * (ptrdiff_t) myedges[idim + 1];
427 #endif
428  iocount[idim] = 1;
429  length[idim] = ((size_t)mymap[idim]) * myedges[idim];
430  stop[idim] = (mystart[idim] + myedges[idim] * (size_t)mystride[idim]);
431  }
432 
433  /*
434  * Check start, edges
435  */
436  for (idim = maxidim; idim >= 0; --idim)
437  {
438  size_t dimlen =
439  idim == 0 && isrecvar
440  ? numrecs
441  : varshape[idim];
442  if (mystart[idim] >= dimlen)
443  {
444  status = NC_EINVALCOORDS;
445  goto done;
446  }
447 
448  if (mystart[idim] + myedges[idim] > dimlen)
449  {
450  status = NC_EEDGE;
451  goto done;
452  }
453 
454  }
455 
456 
457  /* Lower body */
458  /*
459  * As an optimization, adjust I/O parameters when the fastest
460  * dimension has unity stride both externally and internally.
461  * In this case, the user could have called a simpler routine
462  * (i.e. ncvar$1()
463  */
464  if (mystride[maxidim] == 1
465  && mymap[maxidim] == 1)
466  {
467  iocount[maxidim] = myedges[maxidim];
468  mystride[maxidim] = (ptrdiff_t) myedges[maxidim];
469  mymap[maxidim] = (ptrdiff_t) length[maxidim];
470  }
471 
472  /*
473  * Perform I/O. Exit when done.
474  */
475  for (;;)
476  {
477  /* TODO: */
478  int lstatus = NC_get_vara(ncid, varid, mystart, iocount,
479  value, memtype);
480  if (lstatus != NC_NOERR) {
481  if(status == NC_NOERR || lstatus != NC_ERANGE)
482  status = lstatus;
483  }
484  /*
485  * The following code permutes through the variable s
486  * external start-index space and it s internal address
487  * space. At the UPC, this algorithm is commonly
488  * called "odometer code".
489  */
490  idim = maxidim;
491  carry:
492  value += (((int)mymap[idim]) * memtypelen);
493  mystart[idim] += (size_t)mystride[idim];
494  if (mystart[idim] == stop[idim])
495  {
496  size_t l = (length[idim] * (size_t)memtypelen);
497  value -= l;
498  mystart[idim] = start[idim];
499  if (--idim < 0)
500  break; /* normal return */
501  goto carry;
502  }
503  } /* I/O loop */
504  done:
505  free(mystart);
506  } /* variable is array */
507  return status;
508 }
509 
513 static int
514 NC_get_vars(int ncid, int varid, const size_t *start,
515  const size_t *edges, const ptrdiff_t *stride, void *value,
516  nc_type memtype)
517 {
518  NC* ncp;
519  int stat = NC_check_id(ncid, &ncp);
520 
521  if(stat != NC_NOERR) return stat;
522 #ifdef USE_NETCDF4
523  if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
524 #endif
525  return ncp->dispatch->get_vars(ncid,varid,start,edges,stride,value,memtype);
526 }
527 
532 static int
533 NC_get_varm(int ncid, int varid, const size_t *start,
534  const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t* map,
535  void *value, nc_type memtype)
536 {
537  NC* ncp;
538  int stat = NC_check_id(ncid, &ncp);
539 
540  if(stat != NC_NOERR) return stat;
541 #ifdef USE_NETCDF4
542  if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
543 #endif
544  return ncp->dispatch->get_varm(ncid,varid,start,edges,stride,map,value,memtype);
545 }
546  /* All these functions are part of this named group... */
551 
626 int
627 nc_get_vara(int ncid, int varid, const size_t *startp,
628  const size_t *countp, void *ip)
629 {
630  NC* ncp = NULL;
631  nc_type xtype = NC_NAT;
632  int stat = NC_check_id(ncid, &ncp);
633  if(stat != NC_NOERR) return stat;
634  stat = nc_inq_vartype(ncid, varid, &xtype);
635  if(stat != NC_NOERR) return stat;
636  return NC_get_vara(ncid, varid, startp, countp, ip, xtype);
637 }
638 
639 int
640 nc_get_vara_text(int ncid, int varid, const size_t *startp,
641  const size_t *countp, char *ip)
642 {
643  NC* ncp;
644  int stat = NC_check_id(ncid, &ncp);
645  if(stat != NC_NOERR) return stat;
646  return NC_get_vara(ncid, varid, startp, countp,
647  (void *)ip, NC_CHAR);
648 }
649 
650 int
651 nc_get_vara_schar(int ncid, int varid, const size_t *startp,
652  const size_t *countp, signed char *ip)
653 {
654  NC* ncp;
655  int stat = NC_check_id(ncid, &ncp);
656  if(stat != NC_NOERR) return stat;
657  return NC_get_vara(ncid, varid, startp, countp,
658  (void *)ip, NC_BYTE);
659 }
660 
661 int
662 nc_get_vara_uchar(int ncid, int varid, const size_t *startp,
663  const size_t *countp, unsigned char *ip)
664 {
665  NC* ncp;
666  int stat = NC_check_id(ncid, &ncp);
667  if(stat != NC_NOERR) return stat;
668  return NC_get_vara(ncid, varid, startp, countp,
669  (void *)ip, T_uchar);
670 }
671 
672 int
673 nc_get_vara_short(int ncid, int varid, const size_t *startp,
674  const size_t *countp, short *ip)
675 {
676  NC* ncp;
677  int stat = NC_check_id(ncid, &ncp);
678  if(stat != NC_NOERR) return stat;
679  return NC_get_vara(ncid, varid, startp, countp,
680  (void *)ip, NC_SHORT);
681 }
682 
683 int
684 nc_get_vara_int(int ncid, int varid,
685  const size_t *startp, const size_t *countp, int *ip)
686 {
687  NC* ncp;
688  int stat = NC_check_id(ncid, &ncp);
689  if(stat != NC_NOERR) return stat;
690  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_INT);
691 }
692 
693 int
694 nc_get_vara_long(int ncid, int varid,
695  const size_t *startp, const size_t *countp, long *ip)
696 {
697  NC* ncp;
698  int stat = NC_check_id(ncid, &ncp);
699  if(stat != NC_NOERR) return stat;
700  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_long);
701 }
702 
703 int
704 nc_get_vara_float(int ncid, int varid,
705  const size_t *startp, const size_t *countp, float *ip)
706 {
707  NC* ncp;
708  int stat = NC_check_id(ncid, &ncp);
709  if(stat != NC_NOERR) return stat;
710  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_float);
711 }
712 
713 
714 int
715 nc_get_vara_double(int ncid, int varid, const size_t *startp,
716  const size_t *countp, double *ip)
717 {
718  NC* ncp;
719  int stat = NC_check_id(ncid, &ncp);
720  if(stat != NC_NOERR) return stat;
721  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_double);
722 }
723 
724 int
725 nc_get_vara_ubyte(int ncid, int varid,
726  const size_t *startp, const size_t *countp, unsigned char *ip)
727 {
728  NC* ncp;
729  int stat = NC_check_id(ncid, &ncp);
730  if(stat != NC_NOERR) return stat;
731  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_ubyte);
732 }
733 
734 int
735 nc_get_vara_ushort(int ncid, int varid,
736  const size_t *startp, const size_t *countp, unsigned short *ip)
737 {
738  NC* ncp;
739  int stat = NC_check_id(ncid, &ncp);
740  if(stat != NC_NOERR) return stat;
741  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_ushort);
742 }
743 
744 int
745 nc_get_vara_uint(int ncid, int varid,
746  const size_t *startp, const size_t *countp, unsigned int *ip)
747 {
748  NC* ncp;
749  int stat = NC_check_id(ncid, &ncp);
750  if(stat != NC_NOERR) return stat;
751  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_uint);
752 }
753 
754 int
755 nc_get_vara_longlong(int ncid, int varid,
756  const size_t *startp, const size_t *countp, long long *ip)
757 {
758  NC* ncp;
759  int stat = NC_check_id(ncid, &ncp);
760  if(stat != NC_NOERR) return stat;
761  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_longlong);
762 }
763 
764 int
765 nc_get_vara_ulonglong(int ncid, int varid,
766  const size_t *startp, const size_t *countp, unsigned long long *ip)
767 {
768  NC* ncp;
769  int stat = NC_check_id(ncid, &ncp);
770  if(stat != NC_NOERR) return stat;
771  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_UINT64);
772 }
773 
774 #ifdef USE_NETCDF4
775 int
776 nc_get_vara_string(int ncid, int varid,
777  const size_t *startp, const size_t *countp, char* *ip)
778 {
779  NC* ncp;
780  int stat = NC_check_id(ncid, &ncp);
781  if(stat != NC_NOERR) return stat;
782  return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_STRING);
783 }
784 
785 #endif /*USE_NETCDF4*/
786 
822 int
823 nc_get_var1(int ncid, int varid, const size_t *indexp, void *ip)
824 {
825  return NC_get_var1(ncid, varid, indexp, ip, NC_NAT);
826 }
827 
828 int
829 nc_get_var1_text(int ncid, int varid, const size_t *indexp, char *ip)
830 {
831  NC* ncp;
832  int stat = NC_check_id(ncid, &ncp);
833  if(stat != NC_NOERR) return stat;
834  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_CHAR);
835 }
836 
837 int
838 nc_get_var1_schar(int ncid, int varid, const size_t *indexp, signed char *ip)
839 {
840  NC* ncp;
841  int stat = NC_check_id(ncid, &ncp);
842  if(stat != NC_NOERR) return stat;
843  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_BYTE);
844 }
845 
846 int
847 nc_get_var1_uchar(int ncid, int varid, const size_t *indexp, unsigned char *ip)
848 {
849  NC* ncp;
850  int stat = NC_check_id(ncid, &ncp);
851  if(stat != NC_NOERR) return stat;
852  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UBYTE);
853 }
854 
855 int
856 nc_get_var1_short(int ncid, int varid, const size_t *indexp, short *ip)
857 {
858  NC* ncp;
859  int stat = NC_check_id(ncid, &ncp);
860  if(stat != NC_NOERR) return stat;
861  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_SHORT);
862 }
863 
864 int
865 nc_get_var1_int(int ncid, int varid, const size_t *indexp, int *ip)
866 {
867  NC* ncp;
868  int stat = NC_check_id(ncid, &ncp);
869  if(stat != NC_NOERR) return stat;
870  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_INT);
871 }
872 
873 int
874 nc_get_var1_long(int ncid, int varid, const size_t *indexp,
875  long *ip)
876 {
877  NC* ncp;
878  int stat = NC_check_id(ncid, &ncp);
879  if(stat != NC_NOERR) return stat;
880  return NC_get_var1(ncid, varid, indexp, (void *)ip, longtype);
881 }
882 
883 int
884 nc_get_var1_float(int ncid, int varid, const size_t *indexp,
885  float *ip)
886 {
887  NC* ncp;
888  int stat = NC_check_id(ncid, &ncp);
889  if(stat != NC_NOERR) return stat;
890  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_FLOAT);
891 }
892 
893 int
894 nc_get_var1_double(int ncid, int varid, const size_t *indexp,
895  double *ip)
896 {
897  NC* ncp;
898  int stat = NC_check_id(ncid, &ncp);
899  if(stat != NC_NOERR) return stat;
900  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_DOUBLE);
901 }
902 
903 int
904 nc_get_var1_ubyte(int ncid, int varid, const size_t *indexp,
905  unsigned char *ip)
906 {
907  NC* ncp;
908  int stat = NC_check_id(ncid, &ncp);
909  if(stat != NC_NOERR) return stat;
910  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UBYTE);
911 }
912 
913 int
914 nc_get_var1_ushort(int ncid, int varid, const size_t *indexp,
915  unsigned short *ip)
916 {
917  NC* ncp;
918  int stat = NC_check_id(ncid, &ncp);
919  if(stat != NC_NOERR) return stat;
920  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_USHORT);
921 }
922 
923 int
924 nc_get_var1_uint(int ncid, int varid, const size_t *indexp,
925  unsigned int *ip)
926 {
927  NC* ncp;
928  int stat = NC_check_id(ncid, &ncp);
929  if(stat != NC_NOERR) return stat;
930  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UINT);
931 }
932 
933 int
934 nc_get_var1_longlong(int ncid, int varid, const size_t *indexp,
935  long long *ip)
936 {
937  NC* ncp;
938  int stat = NC_check_id(ncid, &ncp);
939  if(stat != NC_NOERR) return stat;
940  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_INT64);
941 }
942 
943 int
944 nc_get_var1_ulonglong(int ncid, int varid, const size_t *indexp,
945  unsigned long long *ip)
946 {
947  NC* ncp;
948  int stat = NC_check_id(ncid, &ncp);
949  if(stat != NC_NOERR) return stat;
950  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UINT64);
951 }
952 
953 #ifdef USE_NETCDF4
954 int
955 nc_get_var1_string(int ncid, int varid, const size_t *indexp, char* *ip)
956 {
957  NC* ncp;
958  int stat = NC_check_id(ncid, &ncp);
959  if(stat != NC_NOERR) return stat;
960  return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_STRING);
961 }
962 #endif /*USE_NETCDF4*/
963 
1008 int
1009 nc_get_var(int ncid, int varid, void *ip)
1010 {
1011  return NC_get_var(ncid, varid, ip, NC_NAT);
1012 }
1013 
1014 int
1015 nc_get_var_text(int ncid, int varid, char *ip)
1016 {
1017  NC *ncp;
1018  int stat = NC_check_id(ncid, &ncp);
1019  if(stat != NC_NOERR) return stat;
1020  return NC_get_var(ncid, varid, (void *)ip, NC_CHAR);
1021 }
1022 
1023 int
1024 nc_get_var_schar(int ncid, int varid, signed char *ip)
1025 {
1026  NC *ncp;
1027  int stat = NC_check_id(ncid, &ncp);
1028  if(stat != NC_NOERR) return stat;
1029  return NC_get_var(ncid, varid, (void *)ip, NC_BYTE);
1030 }
1031 
1032 int
1033 nc_get_var_uchar(int ncid, int varid, unsigned char *ip)
1034 {
1035  NC *ncp;
1036  int stat = NC_check_id(ncid, &ncp);
1037  if(stat != NC_NOERR) return stat;
1038  return NC_get_var(ncid,varid, (void *)ip, NC_UBYTE);
1039 }
1040 
1041 int
1042 nc_get_var_short(int ncid, int varid, short *ip)
1043 {
1044  NC* ncp;
1045  int stat = NC_check_id(ncid, &ncp);
1046  if(stat != NC_NOERR) return stat;
1047  return NC_get_var(ncid, varid, (void *)ip, NC_SHORT);
1048 }
1049 
1050 int
1051 nc_get_var_int(int ncid, int varid, int *ip)
1052 {
1053  NC* ncp;
1054  int stat = NC_check_id(ncid, &ncp);
1055  if(stat != NC_NOERR) return stat;
1056  return NC_get_var(ncid,varid, (void *)ip, NC_INT);
1057 }
1058 
1059 int
1060 nc_get_var_long(int ncid, int varid, long *ip)
1061 {
1062  NC* ncp;
1063  int stat = NC_check_id(ncid, &ncp);
1064  if(stat != NC_NOERR) return stat;
1065  return NC_get_var(ncid,varid, (void *)ip, longtype);
1066 }
1067 
1068 int
1069 nc_get_var_float(int ncid, int varid, float *ip)
1070 {
1071  NC* ncp;
1072  int stat = NC_check_id(ncid, &ncp);
1073  if(stat != NC_NOERR) return stat;
1074  return NC_get_var(ncid,varid, (void *)ip, NC_FLOAT);
1075 }
1076 
1077 int
1078 nc_get_var_double(int ncid, int varid, double *ip)
1079 {
1080  NC* ncp;
1081  int stat = NC_check_id(ncid, &ncp);
1082  if(stat != NC_NOERR) return stat;
1083  return NC_get_var(ncid,varid, (void *)ip, NC_DOUBLE);
1084 }
1085 
1086 int
1087 nc_get_var_ubyte(int ncid, int varid, unsigned char *ip)
1088 {
1089  NC* ncp;
1090  int stat = NC_check_id(ncid, &ncp);
1091  if(stat != NC_NOERR) return stat;
1092  return NC_get_var(ncid,varid, (void *)ip, NC_UBYTE);
1093 }
1094 
1095 int
1096 nc_get_var_ushort(int ncid, int varid, unsigned short *ip)
1097 {
1098  NC* ncp;
1099  int stat = NC_check_id(ncid, &ncp);
1100  if(stat != NC_NOERR) return stat;
1101  return NC_get_var(ncid,varid, (void *)ip, NC_USHORT);
1102 }
1103 
1104 int
1105 nc_get_var_uint(int ncid, int varid, unsigned int *ip)
1106 {
1107  NC* ncp;
1108  int stat = NC_check_id(ncid, &ncp);
1109  if(stat != NC_NOERR) return stat;
1110  return NC_get_var(ncid,varid, (void *)ip, NC_UINT);
1111 }
1112 
1113 int
1114 nc_get_var_longlong(int ncid, int varid, long long *ip)
1115 {
1116  NC* ncp;
1117  int stat = NC_check_id(ncid, &ncp);
1118  if(stat != NC_NOERR) return stat;
1119  return NC_get_var(ncid,varid, (void *)ip, NC_INT64);
1120 }
1121 
1122 int
1123 nc_get_var_ulonglong(int ncid, int varid, unsigned long long *ip)
1124 {
1125  NC* ncp;
1126  int stat = NC_check_id(ncid, &ncp);
1127  if(stat != NC_NOERR) return stat;
1128  return NC_get_var(ncid,varid, (void *)ip,NC_UINT64);
1129 }
1130 
1131 #ifdef USE_NETCDF4
1132 int
1133 nc_get_var_string(int ncid, int varid, char* *ip)
1134 {
1135  NC* ncp;
1136  int stat = NC_check_id(ncid, &ncp);
1137  if(stat != NC_NOERR) return stat;
1138  return NC_get_var(ncid,varid, (void *)ip,NC_STRING);
1139 }
1140 #endif /*USE_NETCDF4*/
1141 
1183 int
1184 nc_get_vars (int ncid, int varid, const size_t * startp,
1185  const size_t * countp, const ptrdiff_t * stridep,
1186  void *ip)
1187 {
1188  NC* ncp;
1189  int stat = NC_NOERR;
1190 
1191  if ((stat = NC_check_id(ncid, &ncp)))
1192  return stat;
1193  return ncp->dispatch->get_vars(ncid, varid, startp, countp, stridep,
1194  ip, NC_NAT);
1195 }
1196 
1197 int
1198 nc_get_vars_text(int ncid, int varid, const size_t *startp,
1199  const size_t *countp, const ptrdiff_t * stridep,
1200  char *ip)
1201 {
1202  NC* ncp;
1203  int stat = NC_check_id(ncid, &ncp);
1204  if(stat != NC_NOERR) return stat;
1205  return NC_get_vars(ncid,varid,startp, countp, stridep,
1206  (void *)ip, NC_CHAR);
1207 }
1208 
1209 int
1210 nc_get_vars_schar(int ncid, int varid, const size_t *startp,
1211  const size_t *countp, const ptrdiff_t * stridep,
1212  signed char *ip)
1213 {
1214  NC* ncp;
1215  int stat = NC_check_id(ncid, &ncp);
1216  if(stat != NC_NOERR) return stat;
1217  return NC_get_vars(ncid,varid,startp, countp, stridep,
1218  (void *)ip, NC_BYTE);
1219 }
1220 
1221 int
1222 nc_get_vars_uchar(int ncid, int varid, const size_t *startp,
1223  const size_t *countp, const ptrdiff_t * stridep,
1224  unsigned char *ip)
1225 {
1226  NC* ncp;
1227  int stat = NC_check_id(ncid, &ncp);
1228  if(stat != NC_NOERR) return stat;
1229  return NC_get_vars(ncid,varid,startp, countp, stridep,
1230  (void *)ip, T_uchar);
1231 }
1232 
1233 int
1234 nc_get_vars_short(int ncid, int varid, const size_t *startp,
1235  const size_t *countp, const ptrdiff_t *stridep,
1236  short *ip)
1237 {
1238  NC* ncp;
1239  int stat = NC_check_id(ncid, &ncp);
1240  if(stat != NC_NOERR) return stat;
1241  return NC_get_vars(ncid,varid,startp, countp, stridep,
1242  (void *)ip, NC_SHORT);
1243 }
1244 
1245 int
1246 nc_get_vars_int(int ncid, int varid, const size_t *startp,
1247  const size_t *countp, const ptrdiff_t * stridep,
1248  int *ip)
1249 {
1250  NC* ncp;
1251  int stat = NC_check_id(ncid, &ncp);
1252  if(stat != NC_NOERR) return stat;
1253  return NC_get_vars(ncid,varid,startp, countp, stridep,
1254  (void *)ip, NC_INT);
1255 }
1256 
1257 int
1258 nc_get_vars_long(int ncid, int varid, const size_t *startp,
1259  const size_t *countp, const ptrdiff_t * stridep,
1260  long *ip)
1261 {
1262  NC* ncp;
1263  int stat = NC_check_id(ncid, &ncp);
1264  if(stat != NC_NOERR) return stat;
1265  return NC_get_vars(ncid,varid,startp, countp, stridep,
1266  (void *)ip, T_long);
1267 }
1268 
1269 int
1270 nc_get_vars_float(int ncid, int varid, const size_t *startp,
1271  const size_t *countp, const ptrdiff_t * stridep,
1272  float *ip)
1273 {
1274  NC* ncp;
1275  int stat = NC_check_id(ncid, &ncp);
1276  if(stat != NC_NOERR) return stat;
1277  return NC_get_vars(ncid,varid,startp, countp, stridep,
1278  (void *)ip, T_float);
1279 }
1280 
1281 int
1282 nc_get_vars_double(int ncid, int varid, const size_t *startp,
1283  const size_t *countp, const ptrdiff_t * stridep,
1284  double *ip)
1285 {
1286  NC* ncp;
1287  int stat = NC_check_id(ncid, &ncp);
1288  if(stat != NC_NOERR) return stat;
1289  return NC_get_vars(ncid,varid,startp, countp, stridep,
1290  (void *)ip, T_double);
1291 }
1292 
1293 int
1294 nc_get_vars_ubyte(int ncid, int varid, const size_t *startp,
1295  const size_t *countp, const ptrdiff_t * stridep,
1296  unsigned char *ip)
1297 {
1298  NC* ncp;
1299  int stat = NC_check_id(ncid, &ncp);
1300  if(stat != NC_NOERR) return stat;
1301  return NC_get_vars(ncid,varid, startp, countp, stridep,
1302  (void *)ip, T_ubyte);
1303 }
1304 
1305 int
1306 nc_get_vars_ushort(int ncid, int varid, const size_t *startp,
1307  const size_t *countp, const ptrdiff_t * stridep,
1308  unsigned short *ip)
1309 {
1310  NC* ncp;
1311  int stat = NC_check_id(ncid, &ncp);
1312  if(stat != NC_NOERR) return stat;
1313  return NC_get_vars(ncid,varid,startp,countp, stridep,
1314  (void *)ip, T_ushort);
1315 }
1316 
1317 int
1318 nc_get_vars_uint(int ncid, int varid, const size_t *startp,
1319  const size_t *countp, const ptrdiff_t * stridep,
1320  unsigned int *ip)
1321 {
1322  NC* ncp;
1323  int stat = NC_check_id(ncid, &ncp);
1324  if(stat != NC_NOERR) return stat;
1325  return NC_get_vars(ncid,varid,startp, countp, stridep,
1326  (void *)ip, T_uint);
1327 }
1328 
1329 int
1330 nc_get_vars_longlong(int ncid, int varid, const size_t *startp,
1331  const size_t *countp, const ptrdiff_t * stridep,
1332  long long *ip)
1333 {
1334  NC* ncp;
1335  int stat = NC_check_id(ncid, &ncp);
1336  if(stat != NC_NOERR) return stat;
1337  return NC_get_vars(ncid, varid, startp, countp, stridep,
1338  (void *)ip, T_longlong);
1339 }
1340 
1341 int
1342 nc_get_vars_ulonglong(int ncid, int varid, const size_t *startp,
1343  const size_t *countp, const ptrdiff_t * stridep,
1344  unsigned long long *ip)
1345 {
1346  NC* ncp;
1347  int stat = NC_check_id(ncid, &ncp);
1348  if(stat != NC_NOERR) return stat;
1349  return NC_get_vars(ncid, varid, startp, countp, stridep,
1350  (void *)ip, NC_UINT64);
1351 }
1352 
1353 #ifdef USE_NETCDF4
1354 int
1355 nc_get_vars_string(int ncid, int varid,
1356  const size_t *startp, const size_t *countp,
1357  const ptrdiff_t * stridep,
1358  char* *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_STRING);
1365 }
1366 #endif /*USE_NETCDF4*/
1367 
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... */
1614 
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:745
int nc_get_var_uint(int ncid, int varid, unsigned int *ip)
Read an entire variable in one call.
Definition: dvarget.c:1105
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:829
#define NC_ENOMEM
Memory allocation (malloc) failure.
Definition: netcdf.h:353
int nc_get_var_ulonglong(int ncid, int varid, unsigned long long *ip)
Read an entire variable in one call.
Definition: dvarget.c:1123
#define NC_CHAR
ISO/ASCII character.
Definition: netcdf.h:38
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:715
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:44
#define NC_EMAPTYPE
Mapped access for atomic types only.
Definition: netcdf.h:406
#define NC_ERANGE
Math result not representable.
Definition: netcdf.h:352
#define NC_MAX_VAR_DIMS
max per variable dimensions
Definition: netcdf.h:232
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:1198
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:1294
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:955
#define NC_UINT
unsigned 4-byte int
Definition: netcdf.h:46
int nc_get_var_long(int ncid, int varid, long *ip)
Read an entire variable in one call.
Definition: dvarget.c:1060
#define NC_EINVALCOORDS
Index exceeds dimension bound.
Definition: netcdf.h:310
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:47
#define NC_STRING
string
Definition: netcdf.h:49
#define NC_DOUBLE
double precision floating point number
Definition: netcdf.h:43
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:1282
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:1024
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:27
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:776
#define NC_BYTE
signed 1 byte integer
Definition: netcdf.h:37
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:934
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:1330
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:735
int nc_get_var(int ncid, int varid, void *ip)
Read an entire variable in one call.
Definition: dvarget.c:1009
int nc_get_var_int(int ncid, int varid, int *ip)
Read an entire variable in one call.
Definition: dvarget.c:1051
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:673
int nc_get_var_ushort(int ncid, int varid, unsigned short *ip)
Read an entire variable in one call.
Definition: dvarget.c:1096
int nc_get_var_double(int ncid, int varid, double *ip)
Read an entire variable in one call.
Definition: dvarget.c:1078
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:704
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:1133
#define NC_EBADTYPE
Not a netcdf data type.
Definition: netcdf.h:315
#define NC_EEDGE
Start+count exceeds dimension bound.
Definition: netcdf.h:343
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:904
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:847
int nc_get_var1(int ncid, int varid, const size_t *indexp, void *ip)
Read a single datum from a variable.
Definition: dvarget.c:823
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:684
#define NC_ESTRIDE
Illegal stride.
Definition: netcdf.h:344
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:924
#define NC_EINVAL
Invalid Argument.
Definition: netcdf.h:288
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:755
#define NC_INT
signed 4 byte integer
Definition: netcdf.h:40
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:765
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:1222
int nc_get_var_text(int ncid, int varid, char *ip)
Read an entire variable in one call.
Definition: dvarget.c:1015
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:1342
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:1246
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:725
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:884
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:640
#define NC_NAT
Not A Type.
Definition: netcdf.h:36
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:651
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:1270
EXTERNL int nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size)
Inquire about a type.
Definition: dfile.c:1448
#define NC_USHORT
unsigned 2-byte int
Definition: netcdf.h:45
int nc_get_var_ubyte(int ncid, int varid, unsigned char *ip)
Read an entire variable in one call.
Definition: dvarget.c:1087
int nc_get_var_longlong(int ncid, int varid, long long *ip)
Read an entire variable in one call.
Definition: dvarget.c:1114
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:1234
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:914
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:838
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:1210
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:1258
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:1306
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:662
int nc_get_var_float(int ncid, int varid, float *ip)
Read an entire variable in one call.
Definition: dvarget.c:1069
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:856
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:1184
int nc_get_var_short(int ncid, int varid, short *ip)
Read an entire variable in one call.
Definition: dvarget.c:1042
#define NC_SHORT
signed 2 byte integer
Definition: netcdf.h:39
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:944
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:894
int nc_get_var_uchar(int ncid, int varid, unsigned char *ip)
Read an entire variable in one call.
Definition: dvarget.c:1033
#define NC_NOERR
No Error.
Definition: netcdf.h:278
#define NC_ECHAR
Attempt to convert between text & numbers.
Definition: netcdf.h:334
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:874
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:865
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:42
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:627
#define NC_UINT64
unsigned 8-byte int
Definition: netcdf.h:48
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:694
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:1355
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:1318
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 Sun Nov 23 2014 16:20:09 for NetCDF. NetCDF is a Unidata library.