Codebase list coda / upstream/2.24.1
Import upstream version 2.24.1 Debian Janitor 1 year, 4 months ago
40 changed file(s) with 119 addition(s) and 128 deletion(s). Raw diff Collapse all Expand all
+0
-54
.gitignore less more
0 *.o
1 *.lo
2 *.la
3 *.class
4 .deps
5 .dirstamp
6 .libs
7 stamp-*
8 /.indent.pro
9 /Makefile
10 /Makefile.in
11 /aclocal.m4
12 /ar-lib
13 /autom4te.cache/
14 /classnoinst.stamp
15 /coda.h
16 /codacheck
17 /codacmp
18 /codadd
19 /codadump
20 /codaeval
21 /codafind
22 /compile
23 /config.guess
24 /config.h
25 /config.h.in
26 /config.log
27 /config.status
28 /config.sub
29 /configure
30 /depcomp
31 /findtypedef
32 /findtypedef.c
33 /fortran/Makefile
34 /idl/coda_idl.dlm
35 /install-sh
36 /java/build.xml
37 /java/coda.jar
38 /java/doc/Doxyfile
39 /libcoda/coda-expr-parser.c
40 /libcoda/coda-expr-parser.h
41 /libcoda/coda-expr-tokenizer.c
42 /libcoda/doc/Doxyfile
43 /libtool
44 /ltmain.sh
45 /m4/depend.am
46 /m4/libtool.m4
47 /m4/ltoptions.m4
48 /m4/ltsugar.m4
49 /m4/ltversion.m4
50 /m4/lt~obsolete.m4
51 /missing
52 /py-compile
53 /ylwrap
0 2.24.1 2022-12-07
1 ~~~~~~~~~~~~~~~~~
2
3 * Fixed printing of coda.Record objects in Python interface (missing
4 end-of-line and support for 0-dimensional arrays).
5
6 2.24 2022-05-18
7 ~~~~~~~~~~~~~~~
8
9 * Added significant speed improvements for recursive reads in Python interface.
10
011 2.23.1 2022-02-18
112 ~~~~~~~~~~~~~~~~~
213
314 * Improved performance in Python interface for some use cases.
415
5 * Fixed backward compatibility issu with new Python interface (coda.CodaError
16 * Fixed backward compatibility issue with new Python interface (coda.CodaError
617 has been reintroduced as an alias for the new coda.Error exception class).
718
819 2.23 2021-12-17
44
55 project(CODA)
66
7 set(VERSION 2.23.1)
7 set(VERSION 2.24.1)
88 set(CODA_VERSION \"${VERSION}\")
99 set(CPACK_PACKAGE_VERSION ${VERSION})
1010
3434 and all documentation and examples. For the IDL and MATLAB interfaces,
3535 pre-built versions are included for IDL 8.3 and higher for Windows, and
3636 MATLAB R2019b (v9.7) and higher for Windows. For the Python interface, a
37 pre-built version for Python 3.7 is included. For the Java interface, a
38 pre-built version for JDK 8 is included. All CODA interfaces have been
37 pre-built version for Python 3.11 is included. For the Java interface, a
38 pre-built version for JDK 11 is included. All CODA interfaces have been
3939 compiled with HDF4 and HDF5 support built in.
4040
4141 If you do not have the CODA package you need, you can download it from the
5757 - If you plan on using the Python interface you need Python version 2.7 or
5858 higher and the Python 'numpy' and 'cffi' packages.
5959
60 - If you plan on using the Java interface you need JDK/JRE version 8.
60 - If you plan on using the Java interface you need JDK/JRE version 8 or
61 higher.
6162
6263 - If you use Windows you will need to have the Microsoft Visual C++
6364 Redistributable Packages for Visual Studio 2015 installed.
00 Copyright (C) 2007-2022 S[&]T, The Netherlands
11
2 CODA 2.23.1 Release Notes
2 CODA 2.24.1 Release Notes
33
44
55 CODA is the Common Data Access framework that allows reading of scientific data
00 # autoconf file for CODA
1 AC_INIT([CODA],[2.23.1])
1 AC_INIT([CODA],[2.24.1])
22 AC_CONFIG_AUX_DIR([.])
33 AM_INIT_AUTOMAKE(foreign subdir-objects 1.12 -Wall)
44
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="headertitle"><div class="title">Class List</div></div>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="headertitle"><div class="title">ArrayOrderingEnum Class Reference</div></div>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="headertitle"><div class="title">FormatEnum Class Reference</div></div>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="headertitle"><div class="title">NativeTypeEnum Class Reference</div></div>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="headertitle"><div class="title">SpecialTypeEnum Class Reference</div></div>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="headertitle"><div class="title">TypeClassEnum Class Reference</div></div>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="headertitle"><div class="title">Class Index</div></div>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_coda.html">Coda</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_coda.html">Coda</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_coda_exception.html">CodaException</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_coda_exception.html">CodaException</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_cursor.html">Cursor</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_cursor.html">Cursor</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_expression.html">Expression</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_expression.html">Expression</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_product.html">Product</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_product.html">Product</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_type.html">Type</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 <div id="nav-path" class="navpath">
1616 <ul>
1717 <li class="navelem"><b>nl</b></li><li class="navelem"><b>stcorp</b></li><li class="navelem"><b>coda</b></li><li class="navelem"><a class="el" href="classnl_1_1stcorp_1_1coda_1_1_type.html">Type</a></li> </ul>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="contents">
1717 <div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div>
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="contents">
1717 &#160;
1111 <a class="qindex" href="annotated.html">Classes</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div><div class="header">
1717 <div class="headertitle"><div class="title">CODA Java Interface </div></div>
1111 <a class="qindex" href="modules.html">Modules</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="summary">
1111 <a class="qindex" href="modules.html">Modules</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="summary">
1111 <a class="qindex" href="modules.html">Modules</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="summary">
1111 <a class="qindex" href="modules.html">Modules</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="summary">
1111 <a class="qindex" href="modules.html">Modules</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="summary">
1111 <a class="qindex" href="modules.html">Modules</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="summary">
1111 <a class="qindex" href="modules.html">Modules</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="summary">
1111 <a class="qindex" href="modules.html">Modules</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div><div class="header">
1717 <div class="headertitle"><div class="title">CODA C interface </div></div>
1111 <a class="qindex" href="modules.html">Modules</a> &nbsp;
1212 </center>
1313 <hr>
14 <!-- Generated by Doxygen 1.9.2 -->
14 <!-- Generated by Doxygen 1.9.3 -->
1515 </div><!-- top -->
1616 <div class="header">
1717 <div class="headertitle"><div class="title">Modules</div></div>
242242
243243 <div class="fragment"><pre>
244244 import os
245
246245 os.putenv('CODA_DEFINITION', '&lt;your codadef search path&gt;')
247
248 # ...
249
250246 import coda
251247 </pre></div>
252248
9797 index[i] = (int)((int32_t *)data)[i];
9898 break;
9999 default:
100 mexErrMsgTxt("index parameter not of type double or int32");
100 mexErrMsgTxt("Index parameter not of type double or int32");
101101 break;
102102 }
103103 }
138138
139139 if (type_class != coda_array_class)
140140 {
141 mexErrMsgTxt("Error in paramater");
141 mexErrMsgTxt("Using numeric index for type that is not an array");
142142 }
143143
144144 for (i = 0; i < length; i++)
192192 {
193193 if (coda_errno == CODA_ERROR_ARRAY_NUM_DIMS_MISMATCH)
194194 {
195 mexPrintf("ERROR: array dimensions mismatch\n");
196 mexErrMsgTxt("Error in parameter");
195 mexErrMsgTxt("Error in parameter (array dimensions mismatch)");
197196 }
198197 if (coda_errno == CODA_ERROR_ARRAY_OUT_OF_BOUNDS)
199198 {
200 mexPrintf("ERROR: array index out of bounds\n");
201 mexErrMsgTxt("Error in parameter");
199 mexErrMsgTxt("Error in parameter (array index out of bounds)");
202200 }
203201 coda_matlab_coda_error();
204202 }
213211 }
214212 else
215213 {
216 mexErrMsgTxt("Error in paramater");
214 mexErrMsgTxt("Error in parameter (not a string or integer)");
217215 }
218216
219217 if (name != NULL)
811811
812812 elif isinstance(data, numpy.ndarray):
813813 dim = data.shape
814 if len(dim) == 0:
815 dim = [1]
814816 dimString = ""
815817 for d in dim[:-1]:
816818 dimString += "%ix" % (d,)
817819 dimString += "%i" % (dim[-1],)
818 out.write("[%s %s]" % (dimString,self._typeToString[data.dtype.type]))
820 out.write("[%s %s]" % (dimString, self._typeToString[data.dtype.type]))
819821
820822 elif _is_str(data):
821823 out.write("\"%s\"" % (data,))
824826 # if type is none of the above, fall back
825827 # on the type specific __str__() function.
826828 out.write("%s" % (data,))
829
830 out.write("\n")
827831
828832 return out.getvalue()
829833
23812385 #
23822386 # PATH TRAVERSAL
23832387 #
2384 def _traverse_path(cursor, path, start=0):
2388 def _traverse_path(cursor, path, start=0, type_path=None):
23852389 """
23862390 _traverse_path() traverses the specified path until
23872391 an array with variable indices is encountered or the
23902394 thrown when a check fails.
23912395 """
23922396
2397 reldepth = 0
2398
23932399 for pathIndex in range(start, len(path)):
2400 if type_path is not None:
2401 index = type_path[pathIndex]
2402 if index is not None:
2403 if _goto_index(cursor._x, index) != 0: # optimized to avoid lookup, boilerplate call
2404 raise CodacError('coda_cursor_goto_record_field_by_index')
2405 reldepth += 1
2406 continue
2407
23942408 if isinstance(path[pathIndex], str):
23952409 cursor_goto(cursor, path[pathIndex])
2410 reldepth += 1
23962411 else:
23972412 if isinstance(path[pathIndex], int):
23982413 arrayIndex = [path[pathIndex]]
24282443 raise ValueError("array index (%i) exceeds array range [0:%i)" % (arrayIndex[i], arrayShape[i]))
24292444
24302445 if intermediateArray:
2431 return (True, pathIndex)
2446 return (True, pathIndex, reldepth)
24322447 else:
24332448 # if all indices are non-variable, just move the cursor
24342449 # to the indicated element.
24362451 cursor_goto_array_element(cursor, [])
24372452 else:
24382453 cursor_goto_array_element(cursor, arrayIndex)
2454 reldepth += 1
24392455
24402456 # we've arrived at the end of the path.
2441 return (False, len(path) - 1)
2457 return (False, len(path) - 1, reldepth)
24422458
24432459
24442460 #
24452461 # HELPER FUNCTIONS FOR CODA.FETCH()
24462462 #
2447 def _fetch_intermediate_array(cursor, path, pathIndex=0): # TODO use type tree!
2463 def _fetch_intermediate_array(cursor, path, pathIndex=0, type_path=None):
24482464 """
24492465 _fetch_intermediate_array calls _traverse_path() to traverse the path
24502466 until the end is reached or an intermediate array is encountered.
24542470 recursively fetches each element of the array. note that this will result
24552471 in calls to _fetch_data().
24562472 """
2457
24582473 arrayShape = cursor_get_array_dim(cursor)
24592474
24602475 # handle a rank-0 array by converting it to
25192534 for i in range(0, elementCount):
25202535 # move the cursor to the next required array element.
25212536 while currentElementIndex < nextElementIndex:
2522 cursor_goto_next_array_element(cursor)
2537 if _goto_next_elem(cursor._x) != 0: # optimized to avoid lookup, boilerplate call
2538 raise CodacError('coda_cursor_goto_next_array_element')
25232539 currentElementIndex += 1
25242540
2525 depth = cursor_get_depth(cursor)
2526
25272541 # traverse the path.
2528 (intermediateNode, copiedPathIndex) = _traverse_path(cursor, path, pathIndex + 1)
2542 (intermediateNode, copiedPathIndex, reldepth) = _traverse_path(cursor, path, pathIndex + 1, type_path)
25292543
25302544 # create the result array by examining the type of the first element.
25312545 # This is equivalent to i == 0
25672581 array = numpy.empty(dtype=numpyType, shape=tmpShape)
25682582 else:
25692583 array = numpy.empty(dtype=object, shape=tmpShape)
2584 flat = array.flat # optimization
2585
25702586
25712587 # when this point is reached, a result array has been allocated
25722588 # and the flatArrayIter is set.
25742590 # result stored.
25752591 if intermediateNode:
25762592 # an intermediate array was encountered.
2577 array.flat[i] = _fetch_intermediate_array(cursor, path, copiedPathIndex)
2593 flat[i] = _fetch_intermediate_array(cursor, path, copiedPathIndex, type_path)
25782594 else:
25792595 # the end of the path was reached. from this point on,
25802596 # the entire subtree is fetched.
25812597
25822598 if nodeReader is not None:
2583 array.flat[i] = nodeReader(cursor) # TODO optimize scalar leafs.. better yet, use type tree
2599 flat[i] = nodeReader(cursor)
25842600 else:
2585 array.flat[i] = _fetch_subtree(cursor)
2601 flat[i] = _fetch_subtree(cursor) # TODO add type tree for leafs to type path
25862602
25872603 # update fetchIndex and nextElementIndex.
25882604 for j in range(0, len(fetchShape)):
25952611 fetchIndex[j] = 0
25962612 nextElementIndex -= fetchStep[j + 1]
25972613
2598 for j in range(cursor_get_depth(cursor) - depth):
2599 cursor_goto_parent(cursor)
2614 for j in range(reldepth):
2615 if _goto_parent(cursor._x) != 0: # optimized to avoid lookup, boilerplate call
2616 raise CodacError('coda_cursor_goto_parent')
26002617
26012618 cursor_goto_parent(cursor)
26022619 return array
27252742
27262743 elif class_ == CLASS_SPECIAL:
27272744 return type_tree[1](cursor)
2745
2746
2747 # TODO we currently only cache field indices here, which helps a lot.
2748 # TODO for small arrays, it would probably help to cache more information.
2749 # TODO we probably also want to pre-determine the type tree for leafs.
2750
2751 def _determine_type_path(nodeType, path):
2752 type_path = []
2753 for segment in path:
2754 if isinstance(segment, str):
2755 i = type_get_record_field_index_from_name(nodeType, segment)
2756 type_path.append(i)
2757 nodeType = type_get_record_field_type(nodeType, i)
2758 else:
2759 type_path.append(None)
2760 nodeType = type_get_array_base_type(nodeType)
2761 return type_path
27282762
27292763
27302764 def _determine_type_tree(nodeType):
28292863
28302864 cursor = _get_cursor(start)
28312865
2832 (intermediateNode, pathIndex) = _traverse_path(cursor, path)
2866 (intermediateNode, _, _) = _traverse_path(cursor, path)
28332867 if intermediateNode:
28342868 # we encountered an array with variable (-1) indices.
28352869 # this is only allowed when calling coda.fetch().
28602894
28612895 cursor = _get_cursor(start)
28622896
2863 (intermediateNode, pathIndex) = _traverse_path(cursor, path)
2897 (intermediateNode, _, _) = _traverse_path(cursor, path)
28642898 if intermediateNode:
28652899 # we encountered an array with variable (-1) indices.
28662900 # this is only allowed when calling coda.fetch().
29072941 if _is_str(start):
29082942 product = start = Product(start)
29092943 cursor = _get_cursor(start)
2944 nodeType = cursor_get_type(cursor)
29102945
29112946 # traverse the path
2912 (intermediateNode, pathIndex) = _traverse_path(cursor, path)
2947 (intermediateNode, pathIndex, _) = _traverse_path(cursor, path)
29132948
29142949 try:
29152950 if (intermediateNode):
2916 result = _fetch_intermediate_array(cursor, path, pathIndex)
2951 type_path = _determine_type_path(nodeType, path)
2952 result = _fetch_intermediate_array(cursor, path, pathIndex, type_path)
29172953 else:
29182954 result = _fetch_subtree(cursor)
29192955 finally:
29482984 cursor = _get_cursor(start)
29492985
29502986 # traverse up until the last node of the path.
2951 (intermediateNode, pathIndex) = _traverse_path(cursor, path[:-1])
2987 (intermediateNode, _, _) = _traverse_path(cursor, path[:-1])
29522988 if intermediateNode:
29532989 # we encountered an array with variable (-1) indices.
29542990 # this is only allowed when calling coda.fetch().
29833019
29843020 cursor = _get_cursor(start)
29853021
2986 (intermediateNode, pathIndex) = _traverse_path(cursor, path)
3022 (intermediateNode, _, _) = _traverse_path(cursor, path)
29873023 if intermediateNode:
29883024 # we encountered an array with variable (-1) indices.
29893025 # this is only allowed when calling coda.fetch().
30223058
30233059 cursor = _get_cursor(start)
30243060
3025 (intermediateNode, pathIndex) = _traverse_path(cursor, path)
3061 (intermediateNode, _, _) = _traverse_path(cursor, path)
30263062 if intermediateNode:
30273063 # we encountered an array with variable (-1) indices.
30283064 # this is only allowed when calling coda.fetch().
30643100
30653101 cursor = _get_cursor(start)
30663102
3067 (intermediateNode, pathIndex) = _traverse_path(cursor, path)
3103 (intermediateNode, _, _) = _traverse_path(cursor, path)
30683104 if intermediateNode:
30693105 # we encountered an array with variable (-1) indices.
30703106 # this is only allowed when calling coda.fetch().
31453181
31463182 cursor = _get_cursor(start)
31473183
3148 (intermediateNode, pathIndex) = _traverse_path(cursor, path)
3184 (intermediateNode, _, _) = _traverse_path(cursor, path)
31493185 if intermediateNode:
31503186 # we encountered an array with variable (-1) indices.
31513187 # this is only allowed when calling coda.fetch().
31733209
31743210 def _init():
31753211 """Initialize the CODA Python interface."""
3176 global _lib, _encoding
3212 global _lib, _encoding, _goto_index, _goto_parent, _goto_next_elem
31773213 # Initialize the CODA C library
31783214 clib = _get_c_library_filename()
31793215 _lib = _ffi.dlopen(clib)
3216 _goto_index = _lib.coda_cursor_goto_record_field_by_index
3217 _goto_parent = _lib.coda_cursor_goto_parent
3218 _goto_next_elem = _lib.coda_cursor_goto_next_array_element
31803219
31813220 # Import constants
31823221 for attrname in dir(_lib):