comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » indexing arrays with arrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
indexing arrays with arrays [message #2442] Thu, 30 June 1994 07:31 Go to previous message
ljg is currently offline  ljg
Messages: 5
Registered: January 1993
Junior Member
I have an application where I'm trying to re-bin an array of data sampled
at arbitrary coordinates into an array whose indices indicate sampling
coordinates. (First sum the data into appropriate bins, then average as
necessary, and finally interpolate as appropriate.)

I'm trying to do this "the IDL way" (IMHO) by calculating an index mapping
array and using this map to sum the data into appropriate bins. However,
the behavior isn't what I expect. A simple example:

IDL> a = fltarr(3)
IDL> map = [1, 1, 2]
IDL> a(map) = a(map) + [1.0, 2.0, 3.0]
IDL> print, a
0.00000 2.00000 3.00000

Here "a" will hold the accumulated data and "[1, 1, 2]" is the index re-mapping
array (map the first and second data items to the second destination position
and map the third data item to the third destination position). When I try
to add the data "[1.0, 2.0, 3.0]" I had hoped that "1.0" and "2.0" would
have been summed into a(1) and "3.0" into a(2), resulting in
a = [0.0, 3.0, 3.0].

Why doesn't this work?

larry-granroth@uiowa.edu
[Message index]
 
Read Message
Read Message
Previous Topic: question regarding 3d plotting
Next Topic: Re: question regarding 3d plotting

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:53:37 PDT 2025

Total time taken to generate the page: 0.00420 seconds