OK, thanks for the example. What I see it doing is creating a 2D matrix
of (in this case) 75x50 points. Most of which are = 0. But a
regularly-spaced bunch are set to a random, usually non-zero value.
These are the values you put into the 'samples' array and then use to
make a FlatField.
In this case, your 'sampling domain' runs from 0:74 on one axis, and
0:49 on the other.
Now your _real_ data values are a) not evenly-spaced, and b) occur in
their own domain which is not 0:74 and 0:49.
Here's what I think you should do:
1. read in your data values, and compute the range of values for the
domain components. Let's say the one named 'mass' goes from 22000 to
67000, and the one named 'pi' goes from .1 to 9.15 (I, of course, just
made up these numbers...you can compute them from your input!!).
2. You need to first create a sampling domain that is a reasonable
'density' so that your spikes are narrow "enough". Let's say that means
an 80 x 80 matrix of values. You would then define a Linear2DSet that
goes from 22000 to 67000 and has 80 samples for one component, and from
.1 to 9.15 and 80 samples for the other component.
3. Create an array [80*80] for this sampling domain which is all
zeroes (or whatever value you want), then scan through your _real data_,
and compute which data point in the array it is closes to, and then
set that value to the 'ratio' value (positive or negative) you want.
4. Use this sampling array to create a FlatField, just like you did in
5. You're done...
18 Sep 2002, Brobbey,Isaac wrote:
> thanks for the insight, just to explain what i am doing , the attached code
> does exactly what i like.
> my only problem is that i want to use my data instead of integer2Dset.
> so i am carefully trying to translate this code and use my data instead.
> so my domain values should create the plane just like the integer2Dset is
> doing in the attached code.but these values for the domain should be the pi
> and mass vlues that i am trying to read in.
> i will be very glad if you comment on the code and tell me what is
> -----Original Message-----
> From: Tom Whittaker
> To: Brobbey,Isaac
> Cc: visad-list@xxxxxxxxxxxxx
> Sent: 9/18/02 10:54 AM
> Subject: RE: scaling/Important
> Since you have a 2D domain, your 'protein' array must be dimensioned
> [#samples]. Also, before you construct the Irregular2DSet, you must
> put values into the sampling array. Aside from that, it is not at all
> clear as to what type of domain you really want to make, since your
> nested 'for' loops seem to be trying to fill up a regularly-spaced
> 'grid' of values.
> On Tue, 17 Sep 2002, Brobbey,Isaac wrote:
> > Tom:
> > i finally resolve it and it compile, but the run-time error
> > Exception in thread "main" visad.SetException:
> > sample dimension 1 doesn't match expected length 2
> > at visad.SampledSet.init_samples(SampledSet.java:69)
> > makes me wonder if RealTupleType tuple = new RealTupleType(mass, pi);
> > wrong, because i am trying to make the (mass,pi) as the domain and
> ratio as
> > the range.
> > see the attached file please.
> > Isaac
> Tom Whittaker
> University of Wisconsin-Madison
> Space Science and Engineering Center
> Cooperative Institute for Meteorological Satellite Studies
> Telephone/VoiceMail: 608.262.2759
University of Wisconsin-Madison
Space Science and Engineering Center
Cooperative Institute for Meteorological Satellite Studies