source: XIOS/dev/branch_openmp/extern/src_netcdf4/dvarget.c @ 1501

Last change on this file since 1501 was 409, checked in by ymipsl, 11 years ago

Add improved nectdf internal library src

YM

  • Property svn:eol-style set to native
File size: 38.8 KB
Line 
1/*! \file
2Functions for getting data from variables.
3
4Copyright 2011 University Corporation for Atmospheric
5Research/Unidata. See \ref COPYRIGHT file for more info. */
6
7#include "ncdispatch.h"
8
9
10/** \internal
11\ingroup variables
12
13 */
14int
15NC_get_vara(int ncid, int varid,
16            const size_t *start, const size_t *edges,
17            void *value, nc_type memtype)
18{
19   NC* ncp;
20   int stat = NC_check_id(ncid, &ncp);
21   if(stat != NC_NOERR) return stat;
22#ifdef USE_NETCDF4
23   if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
24#endif
25   if(edges == NULL) {
26      size_t shape[NC_MAX_VAR_DIMS];
27      int ndims;
28      stat = nc_inq_varndims(ncid, varid, &ndims); 
29      if(stat != NC_NOERR) return stat;
30      stat = NC_getshape(ncid,varid,ndims,shape);
31      if(stat != NC_NOERR) return stat;
32      return ncp->dispatch->get_vara(ncid,varid,start,shape,value,memtype);
33   } else
34      return ncp->dispatch->get_vara(ncid,varid,start,edges,value,memtype);
35}
36
37/** \ingroup variables
38\internal
39 */
40static int
41NC_get_var(int ncid, int varid, void *value, nc_type memtype)
42{
43   int ndims;
44   size_t shape[NC_MAX_VAR_DIMS];
45   int stat = nc_inq_varndims(ncid,varid, &ndims);
46   if(stat) return stat;
47   stat = NC_getshape(ncid,varid, ndims, shape);
48   if(stat) return stat;
49   return NC_get_vara(ncid, varid, NC_coord_zero, shape, value, memtype);
50}
51
52/** \internal
53\ingroup variables
54 Most dispatch tables will use the default procedures
55*/
56int
57NCDEFAULT_get_vars(int ncid, int varid, const size_t * start,
58            const size_t * edges, const ptrdiff_t * stride,
59            void *value, nc_type memtype)
60{
61   NC* ncp;
62   int stat = NC_check_id(ncid, &ncp);
63
64   if(stat != NC_NOERR) return stat;
65   return ncp->dispatch->get_varm(ncid,varid,start,edges,stride,NULL,value,memtype);
66}
67
68/** \internal
69\ingroup variables
70 */
71static int
72NC_get_var1(int ncid, int varid, const size_t *coord, void* value, 
73            nc_type memtype)
74{
75   return NC_get_vara(ncid, varid, coord, NC_coord_one, value, memtype);
76}
77
78/** \internal
79\ingroup variables
80 */
81int
82NCDEFAULT_get_varm(int ncid, int varid, const size_t *start,
83            const size_t *edges, const ptrdiff_t *stride,
84            const ptrdiff_t *imapp, void *value0, nc_type memtype)
85{
86   int status = NC_NOERR;
87   nc_type vartype = NC_NAT;
88   int varndims,maxidim;
89   NC* ncp;
90   size_t memtypelen;
91   ptrdiff_t cvtmap[NC_MAX_VAR_DIMS];
92   char* value = (char*)value0;
93
94   status = NC_check_id (ncid, &ncp);
95   if(status != NC_NOERR) return status;
96
97/*
98  if(NC_indef(ncp)) return NC_EINDEFINE;
99*/
100
101   status = nc_inq_vartype(ncid, varid, &vartype); 
102   if(status != NC_NOERR) return status;
103   /* Check that this is an atomic type */
104   if(vartype >= NC_MAX_ATOMIC_TYPE)
105        return NC_EMAPTYPE;
106
107   status = nc_inq_varndims(ncid, varid, &varndims); 
108   if(status != NC_NOERR) return status;
109
110   if(memtype == NC_NAT) {
111      if(imapp != NULL && varndims != 0) {
112         /*
113          * convert map units from bytes to units of sizeof(type)
114          */
115         size_t ii;
116         const ptrdiff_t szof = (ptrdiff_t) nctypelen(vartype);
117         for(ii = 0; ii < varndims; ii++) {
118            if(imapp[ii] % szof != 0) {
119               /*free(cvtmap);*/
120               return NC_EINVAL;
121            }
122            cvtmap[ii] = imapp[ii] / szof;
123         }
124         imapp = cvtmap;
125      }
126      memtype = vartype;
127   }
128
129   if(memtype == NC_CHAR && vartype != NC_CHAR)
130      return NC_ECHAR;
131   else if(memtype != NC_CHAR && vartype == NC_CHAR) 
132      return NC_ECHAR;
133
134   memtypelen = nctypelen(memtype);
135
136   maxidim = (int) varndims - 1;
137
138   if (maxidim < 0)
139   {
140      /*
141       * The variable is a scalar; consequently,
142       * there s only one thing to get and only one place to put it.
143       * (Why was I called?)
144       */
145      size_t edge1[1] = {1};
146      return NC_get_vara(ncid, varid, start, edge1, value, memtype);
147   }
148
149   /*
150    * else
151    * The variable is an array.
152    */
153   {
154      int idim;
155      size_t *mystart = NULL;
156      size_t *myedges;
157      size_t *iocount;    /* count vector */
158      size_t *stop;   /* stop indexes */
159      size_t *length; /* edge lengths in bytes */
160      ptrdiff_t *mystride;
161      ptrdiff_t *mymap;
162      size_t varshape[NC_MAX_VAR_DIMS];
163      int isrecvar;
164      size_t numrecs;
165
166      /* Compute some dimension related values */
167      isrecvar = NC_is_recvar(ncid,varid,&numrecs);
168      NC_getshape(ncid,varid,varndims,varshape);       
169
170      /*
171       * Verify stride argument; also see if stride is all ones
172       */
173      if(stride != NULL) {
174         int stride1 = 1;
175         for (idim = 0; idim <= maxidim; ++idim)
176         {
177            if (stride[idim] == 0
178                /* cast needed for braindead systems with signed size_t */
179                || ((unsigned long) stride[idim] >= X_INT_MAX))
180            {
181               return NC_ESTRIDE;
182            }
183            if(stride[idim] != 1) stride1 = 0;
184         }
185         /* If stride1 is true, and there is no imap
186            then call get_vara directly.
187         */
188         if(stride1 && imapp == NULL) {
189             return NC_get_vara(ncid, varid, start, edges, value, memtype);
190         }
191      }
192
193      /* assert(sizeof(ptrdiff_t) >= sizeof(size_t)); */
194      /* Allocate space for mystart,mystride,mymap etc.all at once */
195      mystart = (size_t *)calloc(varndims * 7, sizeof(ptrdiff_t));
196      if(mystart == NULL) return NC_ENOMEM;
197      myedges = mystart + varndims;
198      iocount = myedges + varndims;
199      stop = iocount + varndims;
200      length = stop + varndims;
201      mystride = (ptrdiff_t *)(length + varndims);
202      mymap = mystride + varndims;
203
204      /*
205       * Initialize I/O parameters.
206       */
207      for (idim = maxidim; idim >= 0; --idim)
208      {
209         mystart[idim] = start != NULL
210            ? start[idim]
211            : 0;
212
213         if (edges != NULL && edges[idim] == 0)
214         {
215            status = NC_NOERR;    /* read/write no data */
216            goto done;
217         }
218
219#ifdef COMPLEX
220         myedges[idim] = edges != NULL
221            ? edges[idim]
222            : idim == 0 && isrecvar
223            ? numrecs - mystart[idim]
224            : varshape[idim] - mystart[idim];
225#else
226         if(edges != NULL)
227            myedges[idim] = edges[idim];
228         else if (idim == 0 && isrecvar)
229            myedges[idim] = numrecs - mystart[idim];
230         else
231            myedges[idim] = varshape[idim] - mystart[idim];
232#endif
233
234         mystride[idim] = stride != NULL
235            ? stride[idim]
236            : 1;
237
238         /* Remember: imapp is byte oriented, not index oriented */
239#ifdef COMPLEX
240         mymap[idim] = (imapp != NULL
241                        ? imapp[idim]
242                        : (idim == maxidim ? 1
243                           : mymap[idim + 1] * (ptrdiff_t) myedges[idim + 1]));
244#else
245         if(imapp != NULL)
246            mymap[idim] = imapp[idim];
247         else if (idim == maxidim)
248            mymap[idim] = 1;
249         else
250            mymap[idim] = 
251               mymap[idim + 1] * (ptrdiff_t) myedges[idim + 1];
252#endif
253         iocount[idim] = 1;
254         length[idim] = mymap[idim] * myedges[idim];
255         stop[idim] = mystart[idim] + myedges[idim] * mystride[idim];
256      }
257
258      /*
259       * Check start, edges
260       */
261      for (idim = maxidim; idim >= 0; --idim)
262      {
263         size_t dimlen = 
264            idim == 0 && isrecvar
265            ? numrecs
266            : varshape[idim];
267         if (mystart[idim] >= dimlen)
268         {
269            status = NC_EINVALCOORDS;
270            goto done;
271         }
272
273         if (mystart[idim] + myedges[idim] > dimlen)
274         {
275            status = NC_EEDGE;
276            goto done;
277         }
278
279      }
280
281
282      /* Lower body */
283      /*
284       * As an optimization, adjust I/O parameters when the fastest
285       * dimension has unity stride both externally and internally.
286       * In this case, the user could have called a simpler routine
287       * (i.e. ncvar$1()
288       */
289      if (mystride[maxidim] == 1
290          && mymap[maxidim] == 1)
291      {
292         iocount[maxidim] = myedges[maxidim];
293         mystride[maxidim] = (ptrdiff_t) myedges[maxidim];
294         mymap[maxidim] = (ptrdiff_t) length[maxidim];
295      }
296
297      /*
298       * Perform I/O.  Exit when done.
299       */
300      for (;;)
301      {
302         /* TODO: */
303         int lstatus = NC_get_vara(ncid, varid, mystart, iocount,
304                                   value, memtype);
305         if (lstatus != NC_NOERR) {
306            if(status == NC_NOERR || lstatus != NC_ERANGE)
307               status = lstatus;
308         }
309         /*
310          * The following code permutes through the variable s
311          * external start-index space and it s internal address
312          * space.  At the UPC, this algorithm is commonly
313          * called "odometer code".
314          */
315         idim = maxidim;
316        carry:
317         value += (mymap[idim] * memtypelen);
318         mystart[idim] += mystride[idim];
319         if (mystart[idim] == stop[idim])
320         {
321            mystart[idim] = start[idim];
322            value -= (length[idim] * memtypelen);
323            if (--idim < 0)
324               break; /* normal return */
325            goto carry;
326         }
327      } /* I/O loop */
328     done:
329      free(mystart);
330   } /* variable is array */
331   return status;
332}
333
334/** \ingroup variables
335\internal
336Called by externally visible nc_get_vars_xxx routines */
337static int
338NC_get_vars(int ncid, int varid, const size_t *start, 
339            const size_t *edges, const ptrdiff_t *stride, void *value,
340            nc_type memtype)
341{
342   NC* ncp;
343   int stat = NC_check_id(ncid, &ncp);
344
345   if(stat != NC_NOERR) return stat;
346#ifdef USE_NETCDF4
347   if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
348#endif
349   return ncp->dispatch->get_vars(ncid,varid,start,edges,stride,value,memtype);
350}
351
352/** \ingroup variables
353\internal
354Called by externally visible nc_get_varm_xxx routines
355 */
356static int
357NC_get_varm(int ncid, int varid, const size_t *start, 
358            const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t* map,
359            void *value, nc_type memtype)
360{
361   NC* ncp;
362   int stat = NC_check_id(ncid, &ncp);
363
364   if(stat != NC_NOERR) return stat;
365#ifdef USE_NETCDF4
366   if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
367#endif
368   return ncp->dispatch->get_varm(ncid,varid,start,edges,stride,map,value,memtype);
369}
370
371/** \name Reading Data from Variables
372
373Functions to read data from variables. */
374/*! \{ */ /* All these functions are part of this named group... */
375
376/** \ingroup variables
377Read an array of values from a variable.
378
379The array to be read is specified by giving a corner and a vector of
380edge lengths to \ref specify_hyperslab.
381
382The data values are read into consecutive locations with the last
383dimension varying fastest. The netCDF dataset must be in data mode
384(for netCDF-4/HDF5 files, the switch to data mode will happen
385automatically, unless the classic model is used).
386
387The nc_get_vara() function will read a variable of any type,
388including user defined type. For this function, the type of the data
389in memory must match the type of the variable - no data conversion is
390done.
391
392Other nc_get_vara_ functions will convert data to the desired output
393type as needed.
394
395\param ncid NetCDF or group ID, from a previous call to nc_open(),
396nc_create(), nc_def_grp(), or associated inquiry functions such as
397nc_inq_ncid().
398
399\param varid Variable ID
400
401\param startp Start vector with one element for each dimension to \ref
402specify_hyperslab.
403
404\param countp Count vector with one element for each dimension to \ref
405specify_hyperslab.
406
407\param ip Pointer where the data will be copied. Memory must be
408allocated by the user before this function is called.
409
410\returns ::NC_NOERR No error.
411\returns ::NC_ENOTVAR Variable not found.
412\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
413\returns ::NC_EEDGE Start+count exceeds dimension bound.
414\returns ::NC_ERANGE One or more of the values are out of range.
415\returns ::NC_EINDEFINE Operation not allowed in define mode.
416\returns ::NC_EBADID Bad ncid.
417
418\section Example
419
420Here is an example using nc_get_vara_double() to read all the values of
421the variable named rh from an existing netCDF dataset named
422foo.nc. For simplicity in this example, we assume that we know that rh
423is dimensioned with time, lat, and lon, and that there are three time
424values, five lat values, and ten lon values.
425
426\code
427     #include <netcdf.h>
428        ...
429     #define TIMES 3
430     #define LATS 5
431     #define LONS 10
432     int  status;                     
433     int ncid;                         
434     int rh_id;                       
435     static size_t start[] = {0, 0, 0};
436     static size_t count[] = {TIMES, LATS, LONS};
437     double rh_vals[TIMES*LATS*LONS];
438        ...
439     status = nc_open("foo.nc", NC_NOWRITE, &ncid);
440     if (status != NC_NOERR) handle_error(status);
441        ...
442     status = nc_inq_varid (ncid, "rh", &rh_id);
443     if (status != NC_NOERR) handle_error(status);
444        ...
445     status = nc_get_vara_double(ncid, rh_id, start, count, rh_vals);
446     if (status != NC_NOERR) handle_error(status);
447\endcode
448 */
449/**@{*/
450int
451nc_get_vara(int ncid, int varid, const size_t *startp, 
452            const size_t *countp, void *ip)
453{
454   NC* ncp = NULL;
455   nc_type xtype = NC_NAT;
456   int stat = NC_check_id(ncid, &ncp);
457   if(stat != NC_NOERR) return stat;
458   stat = nc_inq_vartype(ncid, varid, &xtype);
459   if(stat != NC_NOERR) return stat;
460   return NC_get_vara(ncid, varid, startp, countp, ip, xtype);
461}
462
463int
464nc_get_vara_text(int ncid, int varid, const size_t *startp, 
465                 const size_t *countp, char *ip)
466{
467   NC* ncp;
468   int stat = NC_check_id(ncid, &ncp);
469   if(stat != NC_NOERR) return stat;
470   return NC_get_vara(ncid, varid, startp, countp, 
471                      (void *)ip, NC_CHAR);
472}
473
474int
475nc_get_vara_schar(int ncid, int varid, const size_t *startp, 
476                  const size_t *countp, signed char *ip)
477{
478   NC* ncp;
479   int stat = NC_check_id(ncid, &ncp);
480   if(stat != NC_NOERR) return stat;
481   return NC_get_vara(ncid, varid, startp, countp, 
482                      (void *)ip, NC_BYTE);
483}
484
485int
486nc_get_vara_uchar(int ncid, int varid, const size_t *startp, 
487                  const size_t *countp, unsigned char *ip)
488{
489   NC* ncp;
490   int stat = NC_check_id(ncid, &ncp);
491   if(stat != NC_NOERR) return stat;
492   return NC_get_vara(ncid, varid, startp, countp, 
493                      (void *)ip, T_uchar);
494}
495
496int
497nc_get_vara_short(int ncid, int varid, const size_t *startp, 
498                  const size_t *countp, short *ip)
499{
500   NC* ncp;
501   int stat = NC_check_id(ncid, &ncp);
502   if(stat != NC_NOERR) return stat;
503   return NC_get_vara(ncid, varid, startp, countp, 
504                      (void *)ip, NC_SHORT);
505}
506
507int
508nc_get_vara_int(int ncid, int varid,
509                const size_t *startp, const size_t *countp, int *ip)
510{
511   NC* ncp;
512   int stat = NC_check_id(ncid, &ncp);
513   if(stat != NC_NOERR) return stat;
514   return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_INT);
515}
516
517int
518nc_get_vara_long(int ncid, int varid,
519                 const size_t *startp, const size_t *countp, long *ip)
520{
521   NC* ncp;
522   int stat = NC_check_id(ncid, &ncp);
523   if(stat != NC_NOERR) return stat;
524   return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_long);
525}
526
527int
528nc_get_vara_float(int ncid, int varid,
529                  const size_t *startp, const size_t *countp, float *ip)
530{
531   NC* ncp;
532   int stat = NC_check_id(ncid, &ncp);
533   if(stat != NC_NOERR) return stat;
534   return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_float);
535}
536
537
538int
539nc_get_vara_double(int ncid, int varid, const size_t *startp, 
540                   const size_t *countp, double *ip)
541{
542   NC* ncp;
543   int stat = NC_check_id(ncid, &ncp);
544   if(stat != NC_NOERR) return stat;
545   return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_double);
546}
547
548int
549nc_get_vara_ubyte(int ncid, int varid,
550                  const size_t *startp, const size_t *countp, unsigned char *ip)
551{
552   NC* ncp;
553   int stat = NC_check_id(ncid, &ncp);
554   if(stat != NC_NOERR) return stat;
555   return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_ubyte);
556}
557
558int
559nc_get_vara_ushort(int ncid, int varid,
560                   const size_t *startp, const size_t *countp, unsigned short *ip)
561{
562   NC* ncp;
563   int stat = NC_check_id(ncid, &ncp);
564   if(stat != NC_NOERR) return stat;
565   return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_ushort);
566}
567
568int
569nc_get_vara_uint(int ncid, int varid,
570                 const size_t *startp, const size_t *countp, unsigned int *ip)
571{
572   NC* ncp;
573   int stat = NC_check_id(ncid, &ncp);
574   if(stat != NC_NOERR) return stat;
575   return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_uint);
576}
577
578int
579nc_get_vara_longlong(int ncid, int varid,
580                     const size_t *startp, const size_t *countp, long long *ip)
581{
582   NC* ncp;
583   int stat = NC_check_id(ncid, &ncp);
584   if(stat != NC_NOERR) return stat;
585   return NC_get_vara(ncid,varid,startp,countp, (void *)ip,T_longlong);
586}
587
588int
589nc_get_vara_ulonglong(int ncid, int varid,
590                      const size_t *startp, const size_t *countp, unsigned long long *ip)
591{
592   NC* ncp;
593   int stat = NC_check_id(ncid, &ncp);
594   if(stat != NC_NOERR) return stat;
595   return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_UINT64);
596}
597
598#ifdef USE_NETCDF4
599int
600nc_get_vara_string(int ncid, int varid,
601                   const size_t *startp, const size_t *countp, char* *ip)
602{
603   NC* ncp;
604   int stat = NC_check_id(ncid, &ncp);
605   if(stat != NC_NOERR) return stat;
606   return NC_get_vara(ncid,varid,startp,countp, (void *)ip,NC_STRING);
607}
608
609#endif /*USE_NETCDF4*/
610/**@}*/
611
612/** \ingroup variables
613Read a single datum from a variable.
614
615Inputs are the netCDF ID, the variable ID, a multidimensional index
616that specifies which value to get, and the address of a location into
617which the data value will be read. The value is converted from the
618external data type of the variable, if necessary.
619
620The nc_get_var1() function will read a variable of any type, including
621user defined type. For this function, the type of the data in memory
622must match the type of the variable - no data conversion is done.
623
624Other nc_get_var1_ functions will convert data to the desired output
625type as needed.
626
627\param ncid NetCDF or group ID, from a previous call to nc_open(),
628nc_create(), nc_def_grp(), or associated inquiry functions such as
629nc_inq_ncid().
630
631\param varid Variable ID
632
633\param indexp Index vector with one element for each dimension.
634
635\param ip Pointer where the data will be copied. Memory must be
636allocated by the user before this function is called.
637
638\returns ::NC_NOERR No error.
639\returns ::NC_ENOTVAR Variable not found.
640\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
641\returns ::NC_ERANGE One or more of the values are out of range.
642\returns ::NC_EINDEFINE Operation not allowed in define mode.
643\returns ::NC_EBADID Bad ncid.
644*/
645/** \{ */
646int
647nc_get_var1(int ncid, int varid, const size_t *indexp, void *ip)
648{
649   return NC_get_var1(ncid, varid, indexp, ip, NC_NAT);
650}
651
652int
653nc_get_var1_text(int ncid, int varid, const size_t *indexp, char *ip)
654{
655   NC* ncp;
656   int stat = NC_check_id(ncid, &ncp);
657   if(stat != NC_NOERR) return stat;
658   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_CHAR);
659}
660
661int
662nc_get_var1_schar(int ncid, int varid, const size_t *indexp, signed 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_var1(ncid, varid, indexp, (void *)ip, NC_BYTE);
668}
669
670int
671nc_get_var1_uchar(int ncid, int varid, const size_t *indexp, unsigned char *ip)
672{
673   NC* ncp;
674   int stat = NC_check_id(ncid, &ncp);
675   if(stat != NC_NOERR) return stat;
676   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UBYTE);
677}
678
679int
680nc_get_var1_short(int ncid, int varid, const size_t *indexp, short *ip)
681{
682   NC* ncp;
683   int stat = NC_check_id(ncid, &ncp);
684   if(stat != NC_NOERR) return stat;
685   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_SHORT);
686}
687
688int
689nc_get_var1_int(int ncid, int varid, const size_t *indexp, int *ip)
690{
691   NC* ncp;
692   int stat = NC_check_id(ncid, &ncp);
693   if(stat != NC_NOERR) return stat;
694   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_INT);
695}
696
697int
698nc_get_var1_long(int ncid, int varid, const size_t *indexp, 
699                 long *ip)
700{
701   NC* ncp;
702   int stat = NC_check_id(ncid, &ncp);
703   if(stat != NC_NOERR) return stat;
704   return NC_get_var1(ncid, varid, indexp, (void *)ip, longtype);
705}
706
707int
708nc_get_var1_float(int ncid, int varid, const size_t *indexp, 
709                  float *ip)
710{
711   NC* ncp;
712   int stat = NC_check_id(ncid, &ncp);
713   if(stat != NC_NOERR) return stat;
714   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_FLOAT);
715}
716
717int
718nc_get_var1_double(int ncid, int varid, const size_t *indexp, 
719                   double *ip)
720{
721   NC* ncp;
722   int stat = NC_check_id(ncid, &ncp);
723   if(stat != NC_NOERR) return stat;
724   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_DOUBLE);
725}
726
727int
728nc_get_var1_ubyte(int ncid, int varid, const size_t *indexp, 
729                  unsigned char *ip)
730{
731   NC* ncp;
732   int stat = NC_check_id(ncid, &ncp);
733   if(stat != NC_NOERR) return stat;
734   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UBYTE);
735}
736
737int
738nc_get_var1_ushort(int ncid, int varid, const size_t *indexp, 
739                   unsigned short *ip)
740{
741   NC* ncp;
742   int stat = NC_check_id(ncid, &ncp);
743   if(stat != NC_NOERR) return stat;
744   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_USHORT);
745}
746
747int
748nc_get_var1_uint(int ncid, int varid, const size_t *indexp, 
749                 unsigned int *ip)
750{
751   NC* ncp;
752   int stat = NC_check_id(ncid, &ncp);
753   if(stat != NC_NOERR) return stat;
754   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_INT);
755}
756
757int
758nc_get_var1_longlong(int ncid, int varid, const size_t *indexp, 
759                     long long *ip)
760{
761   NC* ncp;
762   int stat = NC_check_id(ncid, &ncp);
763   if(stat != NC_NOERR) return stat;
764   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_INT64);
765}
766
767int
768nc_get_var1_ulonglong(int ncid, int varid, const size_t *indexp, 
769                      unsigned long long *ip)
770{
771   NC* ncp;
772   int stat = NC_check_id(ncid, &ncp);
773   if(stat != NC_NOERR) return stat;
774   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_UINT64);
775}
776
777#ifdef USE_NETCDF4
778int
779nc_get_var1_string(int ncid, int varid, const size_t *indexp, char* *ip)
780{
781   NC* ncp;
782   int stat = NC_check_id(ncid, &ncp);
783   if(stat != NC_NOERR) return stat;
784   return NC_get_var1(ncid, varid, indexp, (void *)ip, NC_STRING);
785}
786#endif /*USE_NETCDF4*/
787/** \} */
788
789/** \ingroup variables
790Read an entire variable in one call.
791
792This function will read all the values from a netCDF variable of an
793open netCDF dataset.
794
795This is the simplest interface to use for reading the value of a
796scalar variable or when all the values of a multidimensional variable
797can be read at once. The values are read into consecutive locations
798with the last dimension varying fastest. The netCDF dataset must be in
799data mode.
800
801Take care when using this function with record variables (variables
802that use the ::NC_UNLIMITED dimension). If you try to read all the
803values of a record variable into an array but there are more records
804in the file than you assume, more data will be read than you expect,
805which may cause a segmentation violation. To avoid such problems, it
806is better to use the nc_get_vara interfaces for variables that use the
807::NC_UNLIMITED dimension.
808
809The functions for types ubyte, ushort, uint, longlong, ulonglong, and
810string are only available for netCDF-4/HDF5 files.
811
812The nc_get_var() function will read a variable of any type, including
813user defined type. For this function, the type of the data in memory
814must match the type of the variable - no data conversion is done.
815
816\param ncid NetCDF or group ID, from a previous call to nc_open(),
817nc_create(), nc_def_grp(), or associated inquiry functions such as
818nc_inq_ncid().
819
820\param varid Variable ID
821
822\param ip Pointer where the data will be copied. Memory must be
823allocated by the user before this function is called.
824
825\returns ::NC_NOERR No error.
826\returns ::NC_ENOTVAR Variable not found.
827\returns ::NC_ERANGE One or more of the values are out of range.
828\returns ::NC_EINDEFINE Operation not allowed in define mode.
829\returns ::NC_EBADID Bad ncid.
830*/
831/** \{ */
832int
833nc_get_var(int ncid, int varid, void *ip)
834{
835   return NC_get_var(ncid, varid, ip, NC_NAT);
836}
837
838int
839nc_get_var_text(int ncid, int varid, char *ip)
840{
841   NC *ncp;
842   int stat = NC_check_id(ncid, &ncp);
843   if(stat != NC_NOERR) return stat;
844   return NC_get_var(ncid, varid, (void *)ip, NC_CHAR);
845}
846
847int
848nc_get_var_schar(int ncid, int varid, signed char *ip)
849{
850   NC *ncp;
851   int stat = NC_check_id(ncid, &ncp);
852   if(stat != NC_NOERR) return stat;
853   return NC_get_var(ncid, varid, (void *)ip, NC_BYTE);
854}
855
856int
857nc_get_var_uchar(int ncid, int varid, unsigned char *ip)
858{
859   NC *ncp;
860   int stat = NC_check_id(ncid, &ncp);
861   if(stat != NC_NOERR) return stat;
862   return NC_get_var(ncid,varid, (void *)ip, NC_UBYTE);
863}
864
865int
866nc_get_var_short(int ncid, int varid, short *ip)
867{
868   NC* ncp;
869   int stat = NC_check_id(ncid, &ncp);
870   if(stat != NC_NOERR) return stat;
871   return NC_get_var(ncid, varid, (void *)ip, NC_SHORT);
872}
873
874int
875nc_get_var_int(int ncid, int varid, int *ip)
876{
877   NC* ncp;
878   int stat = NC_check_id(ncid, &ncp);
879   if(stat != NC_NOERR) return stat;
880   return NC_get_var(ncid,varid, (void *)ip, NC_INT);
881}
882
883int
884nc_get_var_long(int ncid, int varid, long *ip)
885{
886   NC* ncp;
887   int stat = NC_check_id(ncid, &ncp);
888   if(stat != NC_NOERR) return stat;
889   return NC_get_var(ncid,varid, (void *)ip, longtype);
890}
891
892int
893nc_get_var_float(int ncid, int varid, float *ip)
894{
895   NC* ncp;
896   int stat = NC_check_id(ncid, &ncp);
897   if(stat != NC_NOERR) return stat;
898   return NC_get_var(ncid,varid, (void *)ip, NC_FLOAT);
899}
900
901int
902nc_get_var_double(int ncid, int varid, double *ip)
903{
904   NC* ncp;
905   int stat = NC_check_id(ncid, &ncp);
906   if(stat != NC_NOERR) return stat;
907   return NC_get_var(ncid,varid, (void *)ip, NC_DOUBLE);
908}
909
910int
911nc_get_var_ubyte(int ncid, int varid, unsigned char *ip)
912{
913   NC* ncp;
914   int stat = NC_check_id(ncid, &ncp);
915   if(stat != NC_NOERR) return stat;
916   return NC_get_var(ncid,varid, (void *)ip, NC_UBYTE);
917}
918
919int
920nc_get_var_ushort(int ncid, int varid, unsigned short *ip)
921{
922   NC* ncp;
923   int stat = NC_check_id(ncid, &ncp);
924   if(stat != NC_NOERR) return stat;
925   return NC_get_var(ncid,varid, (void *)ip, NC_USHORT);
926}
927
928int
929nc_get_var_uint(int ncid, int varid, unsigned int *ip)
930{
931   NC* ncp;
932   int stat = NC_check_id(ncid, &ncp);
933   if(stat != NC_NOERR) return stat;
934   return NC_get_var(ncid,varid, (void *)ip, NC_UINT);
935}
936
937int
938nc_get_var_longlong(int ncid, int varid, long long *ip)
939{
940   NC* ncp;
941   int stat = NC_check_id(ncid, &ncp);
942   if(stat != NC_NOERR) return stat;
943   return NC_get_var(ncid,varid, (void *)ip, NC_INT64);
944}
945
946int
947nc_get_var_ulonglong(int ncid, int varid, unsigned long long *ip)
948{
949   NC* ncp;
950   int stat = NC_check_id(ncid, &ncp);
951   if(stat != NC_NOERR) return stat;
952   return NC_get_var(ncid,varid, (void *)ip,NC_UINT64);
953}
954
955#ifdef USE_NETCDF4
956int
957nc_get_var_string(int ncid, int varid, char* *ip)
958{
959   NC* ncp;
960   int stat = NC_check_id(ncid, &ncp);
961   if(stat != NC_NOERR) return stat;
962   return NC_get_var(ncid,varid, (void *)ip,NC_STRING);
963}
964#endif /*USE_NETCDF4*/
965/** \} */
966
967/** \ingroup variables
968Read a strided array from a variable.
969
970This function reads a subsampled (strided) array section of values
971from a netCDF variable of an open netCDF dataset. The subsampled array
972section is specified by giving a corner, a vector of edge lengths, and
973a stride vector. The values are read with the last dimension of the
974netCDF variable varying fastest. The netCDF dataset must be in data
975mode.
976
977The nc_get_vars() function will read a variable of any type, including
978user defined type. For this function, the type of the data in memory
979must match the type of the variable - no data conversion is done.
980
981\param ncid NetCDF or group ID, from a previous call to nc_open(),
982nc_create(), nc_def_grp(), or associated inquiry functions such as
983nc_inq_ncid().
984
985\param varid Variable ID
986
987\param startp Start vector with one element for each dimension to \ref
988specify_hyperslab.
989
990\param countp Count vector with one element for each dimension to \ref
991specify_hyperslab.
992
993\param stridep Stride vector with one element for each dimension to
994\ref specify_hyperslab.
995
996\param ip Pointer where the data will be copied. Memory must be
997allocated by the user before this function is called.
998
999\returns ::NC_NOERR No error.
1000\returns ::NC_ENOTVAR Variable not found.
1001\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
1002\returns ::NC_ERANGE One or more of the values are out of range.
1003\returns ::NC_EINDEFINE Operation not allowed in define mode.
1004\returns ::NC_EBADID Bad ncid.
1005*/
1006/** \{ */
1007int
1008nc_get_vars (int ncid, int varid, const size_t * startp,
1009             const size_t * countp, const ptrdiff_t * stridep,
1010             void *ip)
1011{
1012   NC* ncp;
1013   int stat = NC_NOERR;
1014
1015   if ((stat = NC_check_id(ncid, &ncp)))
1016       return stat;
1017   return ncp->dispatch->get_vars(ncid, varid, startp, countp, stridep,
1018                      ip, NC_NAT);
1019}
1020
1021int
1022nc_get_vars_text(int ncid, int varid, const size_t *startp, 
1023                 const size_t *countp, const ptrdiff_t * stridep,
1024                 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_vars(ncid,varid,startp, countp, stridep,
1030                      (void *)ip, NC_CHAR);
1031}
1032
1033int
1034nc_get_vars_schar(int ncid, int varid, const size_t *startp, 
1035                  const size_t *countp, const ptrdiff_t * stridep,
1036                  signed char *ip)
1037{
1038   NC* ncp;
1039   int stat = NC_check_id(ncid, &ncp);
1040   if(stat != NC_NOERR) return stat;
1041   return NC_get_vars(ncid,varid,startp, countp, stridep,
1042                      (void *)ip, NC_BYTE);
1043}
1044
1045int
1046nc_get_vars_uchar(int ncid, int varid, const size_t *startp, 
1047                  const size_t *countp, const ptrdiff_t * stridep,
1048                  unsigned char *ip)
1049{
1050   NC* ncp;
1051   int stat = NC_check_id(ncid, &ncp);
1052   if(stat != NC_NOERR) return stat;
1053   return NC_get_vars(ncid,varid,startp, countp, stridep,
1054                      (void *)ip, T_uchar);
1055}
1056
1057int
1058nc_get_vars_short(int ncid, int varid, const size_t *startp, 
1059                  const size_t *countp, const ptrdiff_t *stridep,
1060                  short *ip)
1061{
1062   NC* ncp;
1063   int stat = NC_check_id(ncid, &ncp);
1064   if(stat != NC_NOERR) return stat;
1065   return NC_get_vars(ncid,varid,startp, countp, stridep, 
1066                      (void *)ip, NC_SHORT);
1067}
1068
1069int
1070nc_get_vars_int(int ncid, int varid, const size_t *startp, 
1071                const size_t *countp, const ptrdiff_t * stridep,
1072                int *ip)
1073{
1074   NC* ncp;
1075   int stat = NC_check_id(ncid, &ncp);
1076   if(stat != NC_NOERR) return stat;
1077   return NC_get_vars(ncid,varid,startp, countp, stridep,
1078                      (void *)ip, NC_INT);
1079}
1080
1081int
1082nc_get_vars_long(int ncid, int varid, const size_t *startp, 
1083                 const size_t *countp, const ptrdiff_t * stridep,
1084                 long *ip)
1085{
1086   NC* ncp;
1087   int stat = NC_check_id(ncid, &ncp);
1088   if(stat != NC_NOERR) return stat;
1089   return NC_get_vars(ncid,varid,startp, countp, stridep,
1090                      (void *)ip, T_long);
1091}
1092
1093int
1094nc_get_vars_float(int ncid, int varid, const size_t *startp, 
1095                  const size_t *countp, const ptrdiff_t * stridep,
1096                  float *ip)
1097{
1098   NC* ncp;
1099   int stat = NC_check_id(ncid, &ncp);
1100   if(stat != NC_NOERR) return stat;
1101   return NC_get_vars(ncid,varid,startp, countp, stridep,
1102                      (void *)ip, T_float);
1103}
1104
1105int
1106nc_get_vars_double(int ncid, int varid, const size_t *startp, 
1107                   const size_t *countp, const ptrdiff_t * stridep,
1108                   double *ip)
1109{
1110   NC* ncp;
1111   int stat = NC_check_id(ncid, &ncp);
1112   if(stat != NC_NOERR) return stat;
1113   return NC_get_vars(ncid,varid,startp, countp, stridep,
1114                      (void *)ip, T_double);
1115}
1116
1117int
1118nc_get_vars_ubyte(int ncid, int varid, const size_t *startp, 
1119                  const size_t *countp, const ptrdiff_t * stridep,
1120                  unsigned char *ip)
1121{
1122   NC* ncp;
1123   int stat = NC_check_id(ncid, &ncp);
1124   if(stat != NC_NOERR) return stat;
1125   return NC_get_vars(ncid,varid, startp, countp, stridep,
1126                      (void *)ip, T_ubyte);
1127}
1128
1129int
1130nc_get_vars_ushort(int ncid, int varid, const size_t *startp, 
1131                   const size_t *countp, const ptrdiff_t * stridep,
1132                   unsigned short *ip)
1133{
1134   NC* ncp;
1135   int stat = NC_check_id(ncid, &ncp);
1136   if(stat != NC_NOERR) return stat;
1137   return NC_get_vars(ncid,varid,startp,countp, stridep,
1138                      (void *)ip, T_ushort);
1139}
1140
1141int
1142nc_get_vars_uint(int ncid, int varid, const size_t *startp, 
1143                 const size_t *countp, const ptrdiff_t * stridep,
1144                 unsigned int *ip)
1145{
1146   NC* ncp;
1147   int stat = NC_check_id(ncid, &ncp);
1148   if(stat != NC_NOERR) return stat;
1149   return NC_get_vars(ncid,varid,startp, countp, stridep,
1150                      (void *)ip, T_uint);
1151}
1152
1153int
1154nc_get_vars_longlong(int ncid, int varid, const size_t *startp, 
1155                     const size_t *countp, const ptrdiff_t * stridep,
1156                     long long *ip)
1157{
1158   NC* ncp;
1159   int stat = NC_check_id(ncid, &ncp);
1160   if(stat != NC_NOERR) return stat;
1161   return NC_get_vars(ncid, varid, startp, countp, stridep,
1162                      (void *)ip, T_longlong);
1163}
1164
1165int
1166nc_get_vars_ulonglong(int ncid, int varid, const size_t *startp, 
1167                      const size_t *countp, const ptrdiff_t * stridep,
1168                      unsigned long long *ip)
1169{
1170   NC* ncp;
1171   int stat = NC_check_id(ncid, &ncp);
1172   if(stat != NC_NOERR) return stat;
1173   return NC_get_vars(ncid, varid, startp, countp, stridep,
1174                      (void *)ip, NC_UINT64);
1175}
1176
1177#ifdef USE_NETCDF4
1178int
1179nc_get_vars_string(int ncid, int varid,
1180                   const size_t *startp, const size_t *countp,
1181                   const ptrdiff_t * stridep,
1182                   char* *ip)
1183{
1184   NC* ncp;
1185   int stat = NC_check_id(ncid, &ncp);
1186   if(stat != NC_NOERR) return stat;
1187   return NC_get_vars(ncid, varid, startp, countp, stridep, 
1188                      (void *)ip, NC_STRING);
1189}
1190#endif /*USE_NETCDF4*/
1191/** \} */
1192
1193/** \ingroup variables
1194Read a mapped array from a variable.
1195
1196The nc_get_varm_ type family of functions reads a mapped array section
1197of values from a netCDF variable of an open netCDF dataset. The mapped
1198array section is specified by giving a corner, a vector of edge
1199lengths, a stride vector, and an index mapping vector. The index
1200mapping vector is a vector of integers that specifies the mapping
1201between the dimensions of a netCDF variable and the in-memory
1202structure of the internal data array. No assumptions are made about
1203the ordering or length of the dimensions of the data array. The netCDF
1204dataset must be in data mode.
1205
1206The functions for types ubyte, ushort, uint, longlong, ulonglong, and
1207string are only available for netCDF-4/HDF5 files.
1208
1209The nc_get_varm() function will read a variable of any type, including
1210user defined type. For this function, the type of the data in memory
1211must match the type of the variable - no data conversion is done.
1212
1213\param ncid NetCDF or group ID, from a previous call to nc_open(),
1214nc_create(), nc_def_grp(), or associated inquiry functions such as
1215nc_inq_ncid().
1216
1217\param varid Variable ID
1218
1219\param startp Start vector with one element for each dimension to \ref
1220specify_hyperslab.
1221
1222\param countp Count vector with one element for each dimension to \ref
1223specify_hyperslab.
1224
1225\param stridep Stride vector with one element for each dimension to
1226\ref specify_hyperslab.
1227
1228\param imapp Mapping vector with one element for each dimension to
1229\ref specify_hyperslab.
1230
1231\param ip Pointer where the data will be copied. Memory must be
1232allocated by the user before this function is called.
1233
1234\returns ::NC_NOERR No error.
1235\returns ::NC_ENOTVAR Variable not found.
1236\returns ::NC_EINVALCOORDS Index exceeds dimension bound.
1237\returns ::NC_ERANGE One or more of the values are out of range.
1238\returns ::NC_EINDEFINE Operation not allowed in define mode.
1239\returns ::NC_EBADID Bad ncid.
1240*/
1241/** \{ */
1242int
1243nc_get_varm(int ncid, int varid, const size_t * startp,
1244            const size_t * countp, const ptrdiff_t * stridep,
1245            const ptrdiff_t * imapp, void *ip)
1246{
1247   NC* ncp;
1248   int stat = NC_NOERR;
1249
1250   if ((stat = NC_check_id(ncid, &ncp)))
1251       return stat;
1252   return ncp->dispatch->get_varm(ncid, varid, startp, countp, 
1253                                  stridep, imapp, ip, NC_NAT);
1254}
1255
1256int
1257nc_get_varm_schar(int ncid, int varid,
1258                  const size_t *startp, const size_t *countp,
1259                  const ptrdiff_t *stridep, 
1260                  const ptrdiff_t *imapp, signed char *ip)
1261{
1262   NC *ncp;
1263   int stat = NC_check_id(ncid, &ncp);
1264   if(stat != NC_NOERR) return stat;
1265   return NC_get_varm(ncid, varid, startp, countp,
1266                      stridep, imapp, (void *)ip, NC_BYTE);
1267}
1268
1269int
1270nc_get_varm_uchar(int ncid, int varid,
1271                  const size_t *startp, const size_t *countp,
1272                  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1273                  unsigned char *ip)
1274{
1275   NC *ncp;
1276   int stat = NC_check_id(ncid, &ncp);
1277   if(stat != NC_NOERR) return stat;
1278   return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_uchar);
1279}
1280
1281int
1282nc_get_varm_short(int ncid, int varid, const size_t *startp, 
1283                  const size_t *countp, const ptrdiff_t *stridep, 
1284                  const ptrdiff_t *imapp, short *ip)
1285{
1286   NC *ncp;
1287   int stat = NC_check_id(ncid, &ncp);
1288   if(stat != NC_NOERR) return stat;
1289   return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,NC_SHORT);
1290}
1291
1292int
1293nc_get_varm_int(int ncid, int varid,
1294                const size_t *startp, const size_t *countp,
1295                const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1296                int *ip)
1297{
1298   NC *ncp;
1299   int stat = NC_check_id(ncid, &ncp);
1300   if(stat != NC_NOERR) return stat;
1301   return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,NC_INT);
1302}
1303
1304int
1305nc_get_varm_long(int ncid, int varid,
1306                 const size_t *startp, const size_t *countp,
1307                 const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1308                 long *ip)
1309{
1310   NC *ncp;
1311   int stat = NC_check_id(ncid, &ncp);
1312   if(stat != NC_NOERR) return stat;
1313   return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_long);
1314}
1315
1316int
1317nc_get_varm_float(int ncid, int varid,
1318                  const size_t *startp, const size_t *countp,
1319                  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1320                  float *ip)
1321{
1322   NC *ncp;
1323   int stat = NC_check_id(ncid, &ncp);
1324   if(stat != NC_NOERR) return stat;
1325   return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_float);
1326}
1327
1328int
1329nc_get_varm_double(int ncid, int varid,
1330                   const size_t *startp, const size_t *countp,
1331                   const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1332                   double *ip)
1333{
1334   NC *ncp;
1335   int stat = NC_check_id(ncid, &ncp);
1336   if(stat != NC_NOERR) return stat;
1337   return NC_get_varm(ncid,varid,startp,countp,stridep,imapp, (void *)ip,T_double);
1338}
1339
1340int
1341nc_get_varm_ubyte(int ncid, int varid,
1342                  const size_t *startp, const size_t *countp,
1343                  const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1344                  unsigned char *ip)
1345{
1346   NC *ncp;
1347   int stat = NC_check_id(ncid, &ncp);
1348   if(stat != NC_NOERR) return stat;
1349   return NC_get_varm(ncid,varid,startp,countp,stridep,
1350                      imapp, (void *)ip, T_ubyte);
1351}
1352
1353int
1354nc_get_varm_ushort(int ncid, int varid,
1355                   const size_t *startp, const size_t *countp,
1356                   const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1357                   unsigned short *ip)
1358{
1359   NC *ncp;
1360   int stat = NC_check_id(ncid, &ncp);
1361   if(stat != NC_NOERR) return stat;
1362   return NC_get_varm(ncid, varid, startp, countp, stridep,
1363                      imapp, (void *)ip, T_ushort);
1364}
1365
1366int
1367nc_get_varm_uint(int ncid, int varid,
1368                 const size_t *startp, const size_t *countp,
1369                 const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1370                 unsigned int *ip)
1371{
1372   NC *ncp;
1373   int stat = NC_check_id(ncid, &ncp);
1374   if(stat != NC_NOERR) return stat;
1375   return NC_get_varm(ncid, varid, startp, countp,
1376                      stridep, imapp, (void *)ip, T_uint);
1377}
1378
1379int
1380nc_get_varm_longlong(int ncid, int varid, const size_t *startp, 
1381                     const size_t *countp, const ptrdiff_t *stridep, 
1382                     const ptrdiff_t *imapp, long long *ip)
1383{
1384   NC *ncp;
1385   int stat = NC_check_id(ncid, &ncp);
1386   if(stat != NC_NOERR) return stat;
1387   return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1388                      (void *)ip, T_longlong);
1389}
1390
1391int
1392nc_get_varm_ulonglong(int ncid, int varid,
1393                      const size_t *startp, const size_t *countp,
1394                      const ptrdiff_t *stridep, const ptrdiff_t *imapp,
1395                      unsigned long long *ip)
1396{
1397   NC *ncp;
1398   int stat = NC_check_id(ncid, &ncp);
1399   if(stat != NC_NOERR) return stat;
1400   return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1401                      (void *)ip, NC_UINT64);
1402}
1403
1404int
1405nc_get_varm_text(int ncid, int varid, const size_t *startp, 
1406                 const size_t *countp, const ptrdiff_t *stridep, 
1407                 const ptrdiff_t *imapp, char *ip)
1408{
1409   NC *ncp;
1410   int stat = NC_check_id(ncid, &ncp);
1411   if(stat != NC_NOERR) return stat;
1412   return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1413                      (void *)ip, NC_CHAR);
1414}
1415
1416#ifdef USE_NETCDF4
1417int
1418nc_get_varm_string(int ncid, int varid, const size_t *startp, 
1419                   const size_t *countp, const ptrdiff_t *stridep, 
1420                   const ptrdiff_t *imapp, char **ip)
1421{
1422   NC *ncp;
1423   int stat = NC_check_id(ncid, &ncp);
1424   if(stat != NC_NOERR) return stat;
1425   return NC_get_varm(ncid, varid, startp, countp, stridep, imapp,
1426                      (void *)ip, NC_STRING);
1427}
1428/** \} */
1429#endif /*USE_NETCDF4*/
1430
1431/*! \} */ /* End of named group... */
1432
Note: See TracBrowser for help on using the repository browser.