On Mon, Mar 2, 2009 at 05:08, Brennan Williams <brennan.willi...@visualreservoir.com> wrote: > Ok... I'm using Traits and numpy. > I have a 3D grid with directions I,J and K. > I have NI,NJ,NK cells in the I,J,K directions so I have NI*NJ*NK cells > overall. > I have data arrays with a value for each cell in the grid. > I'm going to store this as a 1D array, i.e. 1....ncells where > ncells=NI*NJ*NK rather than as a 3D array > Apart from lots of other data arrays that will be read in from external > files, I want to create I, J and K data arrays > where the 'I' array contains the I index for the cell, the 'J' array the > J index etc.
I, J, K = numpy.mgrid[0:self.ni, 0:self.nj, 0:self.nk] self.iarray = I.ravel() self.jarray = J.ravel() self.karray = K.ravel() -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion