Bruce Southey wrote:
Christopher Barker provided some code last last year on appending ndarrays eg: http://mail.scipy.org/pipermail/numpy-discussion/2009-November/046634.html
yup, I"d love someone else to pick that up and test/improve it. Anyway, that code only handles 1-d arrays, though that can be structured arrays. I"d like to extend it to handlw n-d arrays, though you could only grow them in the first dimension, which may work for your case. As for performance: My numpy code is a bit slower than using python lists, if you add elements one at a time, and the elements are a standard python data type. It should use less memory though, if that matters. If you add the data in big enough chunks, my method gets better performance.
Ultimately I'm trying to build a tvtk unstructured grid to view in a Traits/tvtk/Mayavi app.
I'd love to see that working, once you've got it!
The grid is ni*nj*nk cells with 8 xyz's per cell (hexahedral cell with 6 faces). However some cells are inactive and therefore don't have geometry. Cells also have "connectivity" to other cells, usually to adjacent cells (e.g. cell i,j,k connected to cell i-1,j,k) but not always.
I'm confused now -- what does the array need to look like in the end? Maybe: ni*nj*nk X 8 X 3 ? How is inactive indicated? Is the connectivity somehow in the same array, or is that stored separately? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov