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