[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help setting up an array
- Subject: Re: Help setting up an array
- From: "Pavel A. Romashkin" <pavel.romashkin(at)noaa.gov>
- Date: Wed, 28 Mar 2001 10:25:30 -0700
- Newsgroups: comp.lang.idl-pvwave
- Organization: NOAA-CMDL-CIRES
- References: <3AC1F278.C4DD2F9C@uea.ac.uk>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:24201
Wow. I apologize for my lack of intelligence, but can you put it into a
more simple language? n-dimensional means to me, with n=5, something like:
var = (5 times, 6 chunks, 10 layers, 1000 columns, 50 rows), or
var = fltarr(5, 6, 10, 1000, 50)
and n must be <= 8 in IDL.
Or, do you mean FLTARR(n, n_points), which is a 2D array? If so, this
will be much simplier.
But based on my very limited understanding of your problem, I can
propose that you use SIZE to get the dimensions of the original array,
then create "discrete boxes", for which you could probably use REBIN
(JD? are you here?). WHERE can tell you where a given point is.
I would not post this reply but I see nobody else replying, so decided
to indicate to Peter that he's beed heard. Where are all the smart folks
this morning?
Cheers,
Pavel
Peter Thorne wrote:
>
> Apologies if this is trivial, but I have been working for about 8 hours
> on it and can't even begin to see how to code it in IDL. Any help very
> gratefully received. I am setting up a function which receives the
> location of points in n-dimensional space for m fields, as well as their
> weights. On call the function does not know the size of any of these
> dimensions.
>
> Simplifying to m=1 (this m dimension should be trivial) the input is:
>
> an array of size (n x npoints) locations of each point in the
> n-dimensional space
>
> a vector of size (npoints) the weights.
>
> Now, what I want to be able to do is re-bin these points into an
> n-dimensional discretized space array which encloses all points. I can
> work out the limits of this space by simply finding min and max in each
> of the n dimensions of the location array. I then need to split this
> grid into nbox n-dimensional discrete boxes (say 50 divisions per
> dimension, boxes need not be of equal size in each dimension) and place
> the respective points in their boxes in this finite representation,
> weighted by weight (trivial).
>
> At present I am having two major problems:
>
> 1. How to declare this discretized array and the limits in n-dimensional
> space of each box into which I bin my values given that I know n and
> nbox.
>
> and doubtless much more difficult to overcome:
>
> 2. How to sensibly code selection criteria to ascertain whether a
> particular value belongs to a particular grid box.
>
> Perhaps it is not possible to code without an a priori knowledge of n -
> the dimensionality of the problem to know how many for loops to use? I
> can't see how where statements could be used.
>
> Any help or useful pointers very gratefully received.
>
> Thanks
>
> Peter