org.das2.dataset
Class DataSetUtil

java.lang.Object
  extended by org.das2.dataset.DataSetUtil

public class DataSetUtil
extends java.lang.Object


Constructor Summary
DataSetUtil()
           
 
Method Summary
static DataSet append(DataSet ds1, DataSet ds2)
          provides convenient method for appending datasets together.
static DataSet append(DataSet ds1, DataSet ds2, CacheTag ct)
          provides convenient method for appending datasets together.
protected static int closest(double[] xx, double x)
          finds the element closest to x in monotonic array xx.
static int closestColumn(DataSet table, Datum datum)
           
static int closestColumn(DataSet table, Datum xdatum, int guessIndex)
          finds the dataset column closest to the value, starting the search at guessIndex.
static int closestColumn(DataSet table, double x, Units units)
           
static java.lang.String[] getAllPlaneIds(DataSet ds)
          returns all planes, including the default plane "".
static int getNextColumn(DataSet ds, Datum datum)
          returns the first column that is after the given datum.
static int getPreviousColumn(DataSet ds, Datum datum)
          returns the first column that is before the given datum.
static double[] getXTagArrayDouble(DataSet vds, Units units)
           
static DatumVector getXTags(DataSet ds)
           
static CacheTag guessCacheTag(DataSet ds)
           
static long guessSizeBytes(DataSet ds)
          Give an estimate of the size of the data set, or PROPERTY_SIZE_BYTES if available.
static Datum guessXTagWidth(DataSet table)
          Provide a reasonable xTagWidth either by returning the specified xTagWidth property, or by statistically looking at the X tags.
static VectorDataSet log10(VectorDataSet ds)
           
static DasPlot visualize(DataSet ds)
          Deprecated. use GraphUtil.visualize( ds );
static DasPlot visualize(DataSet ds, boolean ylog)
          Deprecated. use GraphUtil.visualize( ds, ylog );
static DatumRange xRange(DataSet ds)
           
static int xTagBinarySearch(DataSet ds, Datum datum, int low, int high)
          returns the index of a tag, or the (-(insertion point) - 1).
static DatumRange yRange(DataSet ds)
           
static DatumRange zRange(DataSet ds)
          guess a range that characterizes the data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSetUtil

public DataSetUtil()
Method Detail

guessCacheTag

public static CacheTag guessCacheTag(DataSet ds)

xRange

public static DatumRange xRange(DataSet ds)

yRange

public static DatumRange yRange(DataSet ds)

visualize

public static DasPlot visualize(DataSet ds)
Deprecated. use GraphUtil.visualize( ds );


visualize

public static DasPlot visualize(DataSet ds,
                                boolean ylog)
Deprecated. use GraphUtil.visualize( ds, ylog );


guessXTagWidth

public static Datum guessXTagWidth(DataSet table)
Provide a reasonable xTagWidth either by returning the specified xTagWidth property, or by statistically looking at the X tags.


closest

protected static int closest(double[] xx,
                             double x)
finds the element closest to x in monotonic array xx.

Parameters:
xx - monotonic array of numbers. When xx is decreasing, a copy of the array is made.
x -
Returns:
index of closest value.

xTagBinarySearch

public static int xTagBinarySearch(DataSet ds,
                                   Datum datum,
                                   int low,
                                   int high)
returns the index of a tag, or the (-(insertion point) - 1). (See Arrays.binarySearch)


closestColumn

public static int closestColumn(DataSet table,
                                Datum datum)

closestColumn

public static int closestColumn(DataSet table,
                                double x,
                                Units units)

closestColumn

public static int closestColumn(DataSet table,
                                Datum xdatum,
                                int guessIndex)
finds the dataset column closest to the value, starting the search at guessIndex. Handles monotonically increasing or decreasing tags.

Parameters:
table -
xdatum -
guessIndex -
Returns:

getPreviousColumn

public static int getPreviousColumn(DataSet ds,
                                    Datum datum)
returns the first column that is before the given datum. Note the if the datum identifies (==) an xtag, then the previous column is returned.


getNextColumn

public static int getNextColumn(DataSet ds,
                                Datum datum)
returns the first column that is after the given datum. Note the if the datum identifies (==) an xtag, then the previous column is returned.


getXTagArrayDouble

public static double[] getXTagArrayDouble(DataSet vds,
                                          Units units)

getXTags

public static DatumVector getXTags(DataSet ds)

zRange

public static DatumRange zRange(DataSet ds)
guess a range that characterizes the data. The DataSet property name DataSet.PROPERTY_Z_RANGE can be used by the dataset to explicitly set this.

Returns:
a DatumRange useful for setting axis range.
Throws:
java.lang.UnsupportedOperationException - if the dataset is not a TableDataSet.

guessSizeBytes

public static long guessSizeBytes(DataSet ds)
Give an estimate of the size of the data set, or PROPERTY_SIZE_BYTES if available. Generally this would be used as a penalty against the dataset, and it's probably better to overestimate the dataset size.


append

public static DataSet append(DataSet ds1,
                             DataSet ds2,
                             CacheTag ct)
provides convenient method for appending datasets together. The first dataset may be null, in which case the second is trivially returned. Presently a builder is used to create the new dataset, but in the future more efficient methods will be used. If both ds1 and ds2 are null, then null is returned.

Parameters:
ds1 - the first data set. May be null.
ds2 - the second data set. This data set should be after ds1, and may be null.
ct - the cache tag for the second dataset. May be null, in which case guessCacheTag is used to identify the dataset cache tag.

append

public static DataSet append(DataSet ds1,
                             DataSet ds2)
provides convenient method for appending datasets together. The first dataset may be null, in which case the second is trivially returned. Presently a builder is used to create the new dataset, but in the future more efficient methods will be used. If both ds1 and ds2 are null, then null is returned.

Parameters:
ds1 - the first data set. May be null.
ds2 - the second data set. This data set should be after ds1, and may be null.

log10

public static VectorDataSet log10(VectorDataSet ds)

getAllPlaneIds

public static java.lang.String[] getAllPlaneIds(DataSet ds)
returns all planes, including the default plane "". This is to take care of inconsistent behavior of the ds.getPlaneIds() implementations.