[Numpy-discussion] conditional array indexing
Mon Feb 14 16:39:15 CST 2011
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 index a
1D array with a 2D array.
On 2/14/11 5:24 PM, Robert Kern wrote:
> On Mon, Feb 14, 2011 at 16:21, Bryan Woods<firstname.lastname@example.org> 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
>> roughness value for each class. I am trying to create a new 2D array
>> containing a map of the roughness values.
> roughness = z0_legend[landcover]
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 341 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110214/20cbd6e5/attachment.vcf
More information about the NumPy-Discussion