Re: [Numpy-discussion] conditional array indexing

2011-02-14 Thread Christopher Barker
On 2/14/11 2:39 PM, Bryan Woods wrote: > Thanks for your reply. Unfortunately it is not working that simply. > > This tells me that "only integer arrays with one element can be > converted to an index" Examples, example, examples! I think this is what you want: In [15]: land_cover Out[15]: array

Re: [Numpy-discussion] conditional array indexing

2011-02-14 Thread Pauli Virtanen
On Mon, 14 Feb 2011 17:21:07 -0500, Bryan Woods wrote: [clip] > roughness = np.array(landcover.shape,dtype='f') np.zeros(landcover.shape, dtype='f') ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/nump

Re: [Numpy-discussion] conditional array indexing

2011-02-14 Thread Robert Kern
On Mon, Feb 14, 2011 at 16:39, Bryan Woods wrote: > Thanks for your reply. Unfortunately it is not working that simply. > > This tells me that "only integer arrays with one element can be converted to > an index" > > roughness and landcover are identically shaped 2D arrays. z0_legend in a 1D > loo

Re: [Numpy-discussion] conditional array indexing

2011-02-14 Thread Bryan Woods
Thanks for your reply. Unfortunately it is not working that simply. This tells me that "only integer arrays with one element can be converted to an index" roughness and landcover are identically shaped 2D arrays. z0_legend in a 1D look-up table. I assume the error here comes from trying to in

Re: [Numpy-discussion] conditional array indexing

2011-02-14 Thread Robert Kern
On Mon, Feb 14, 2011 at 16:21, Bryan Woods wrote: > I have spent over an hour now trying to figure out what I thought would be a > really basic conditional array assignment. I am very new to python and am in > need of help. > > I have a 2D integer array of land cover classes and a 1D array with a

[Numpy-discussion] conditional array indexing

2011-02-14 Thread Bryan Woods
I have spent over an hour now trying to figure out what I thought would be a really basic conditional array assignment. I am very new to python and am in need of help. I have a 2D integer array of land cover classes and a 1D array with a roughness value for each class. I am trying to create a

Re: [Numpy-discussion] NumPy Featured on RCE-Cast

2011-02-14 Thread Alok Singhal
___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] using loadtxt() for given number of rows?

2011-02-14 Thread Robert Cimrman
On Mon, 14 Feb 2011, Stéfan van der Walt wrote: Hi Robert On Mon, Jan 31, 2011 at 2:39 PM, Robert Cimrman wrote: It seems to me, that an additional parameter to loadtxt(), say "nrows" or "numrows", would do the job, so that the function does not try reading the entire file. Another possibilit

Re: [Numpy-discussion] using loadtxt() for given number of rows?

2011-02-14 Thread Christopher Barker
On 2/14/11 8:28 AM, Stéfan van der Walt wrote: > You can always read chunks of the file into StringIO objects, and pass > those into loadtxt. true, but there isn't any single method for loading n lines of a file into a StringIO object, either. I"ve always thought that file.readlines() should tak

Re: [Numpy-discussion] using loadtxt() for given number of rows?

2011-02-14 Thread Stéfan van der Walt
Hi Robert On Mon, Jan 31, 2011 at 2:39 PM, Robert Cimrman wrote: > It seems to me, that an additional parameter to loadtxt(), say "nrows" or > "numrows", would do the job, so that the function does not try reading the > entire file. Another possibility would be to raise an exception as it > is no

[Numpy-discussion] NumPy Featured on RCE-Cast

2011-02-14 Thread Brock Palen
Thank you to Travis for taking time to speak about NumPy on rce-cast.com You can find the interview and links to other shows at: http://www.rce-cast.com/Podcast/rce-48-numpy.html Thank you! Brock Palen www.umich.edu/~brockp Center for Advanced Computing bro...@umich.edu (734)936-1985 ___