//
// Irregular1DSet.java
//
/*
VisAD system for interactive analysis and visualization of numerical
data. Copyright (C) 1996 - 2017 Bill Hibbard, Curtis Rueden, Tom
Rink, Dave Glowacki, Steve Emmerson, Tom Whittaker, Don Murray, and
Tommy Jasmin.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
package visad;
/**
Irregular1DSet represents a finite set of samples of R.
Note that Irregular1DSet reorders samples given in the
constructor; to convert between values and indices,
always use the methods valueToIndex and indexToValue.
*/
public class Irregular1DSet extends IrregularSet {
float LowX, HiX;
Gridded1DSet SortedSet;
/** a 1-D irregular set with null errors, CoordinateSystem
and Units are defaults from type */
public Irregular1DSet(MathType type, float[][] samples)
throws VisADException {
this(type, samples, null, null, null, true);
}
/** a 1-D irregular set; samples array is organized
float[1][number_of_samples]; samples need not be
sorted - the constructor sorts samples to define
a 1-D "triangulation";
coordinate_system and units must be compatible with
defaults for type, or may be null; errors may be null */
public Irregular1DSet(MathType type, float[][] samples,
CoordinateSystem coord_sys, Unit[] units,
ErrorEstimate[] errors) throws VisADException {
this(type, samples, coord_sys, units, errors, true);
}
public Irregular1DSet(MathType type, float[][] samples,
CoordinateSystem coord_sys, Unit[] units,
ErrorEstimate[] errors, boolean copy)
throws VisADException {
super(type, samples, samples.length, coord_sys,
units, errors, null, copy);
LowX = Low[0];
HiX = Hi[0];
// sort samples so that creation of a Gridded1DSet is possible
float[][] sortedSamples = new float[1][Length];
float[][]mySamples = getMySamples();
for (int i=0; i "+index2[i]);
}
// test valueToInterp
System.out.println("\nvalueToInterp test:");
int[][] indices = new int[value2[0].length][];
float[][] weights = new float[value2[0].length][];
iSet1D.valueToInterp(value2, indices, weights);
for (int i=0; i ["+indices[i][0]);
for (int j=1; j 0
20.0 --> 1
30.0 --> 1
40.0 --> 3
50.0 --> 4
60.0 --> 6
70.0 --> 7
80.0 --> 7
90.0 --> 8
100.0 --> 8
110.0 --> 8
120.0 --> 9
130.0 --> 9
valueToInterp test:
10.0 --> [0, 0] weight total: 1.0
20.0 --> [1, 1, 0] weight total: 1.0
30.0 --> [1, 1, 2] weight total: 1.0
40.0 --> [3, 3, 4] weight total: 1.0
50.0 --> [4, 4, 3] weight total: 1.0
60.0 --> [6, 6, 5] weight total: 1.0
70.0 --> [7, 7, 8] weight total: 1.0
80.0 --> [7, 7, 8] weight total: 1.0
90.0 --> [8, 8, 7] weight total: 1.0
100.0 --> [8, 8, 7] weight total: 1.0
110.0 --> [8, 8, 9] weight total: 1.0
120.0 --> [9, 9, 8] weight total: 1.0
130.0 --> [9, 9] weight total: 1.0
iris 57%
*/
}
Ads help maintain this website.