org.das2.qds.ops.CoerceUtil

Utility class for reconciling the geometries of two datasets. For example, a rank 1 dataset's values can be repeated to make it rank 2. TODO: dataset geometry is increased by keeping a reference to a dataset with the target geometry. This might result in keeping data in memory that would otherwise be released, so a future implementation of this should probably use a non-qube dataset to store each index's length:

 public int length() {
    return lengths.length()
 }
 public int length(int i0) {
    return lengths.value(i0);
 }

CoerceUtil( )


coerce

coerce( QDataSet ds1, QDataSet ds2, boolean createResult, org.das2.qds.QDataSet[] operands ) → WritableDataSet

increase rank of datasets so that element-wise operations can be performed. For example, if a rank 1 and a rank 2 dataset are to be combined and both have equal dim 0 length, then the rank 1 is promoted to rank 2 by repeating its values. This implements the rule that dimensions in QDataSet have nested context. The second dimension elements are to be understood in the context of the first dimension element. (Except for qubes, where the order is arbitrary.)

Parameters

ds1 - the first operand
ds2 - the second operand
createResult - if true, then a dataset is created where the result can be installed.
operands - the array in which the promoted operands are inserted.

Returns:

an empty dataset where the results can be inserted, or null if createResult is false.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


equalGeom

equalGeom( QDataSet ds1, QDataSet ds2 ) → boolean

returns true if two datasets have the same number of elements in each dimension.

Parameters

ds1 - a QDataSet
ds2 - a QDataSet

Returns:

returns true if two datasets have the same number of elements in each dimension.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


increaseRank0

increaseRank0( QDataSet ds, QDataSet ds2 ) → QDataSet

increase the rank of a rank zero dataset by adding join dimensions that repeat the lower rank elements.

Parameters

ds - a rank 0 dataset
ds2 - dataset to provide rank and lengths.

Returns:

a dataset with the same geometry as ds2.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


increaseRank1

increaseRank1( QDataSet ds, QDataSet ds2 ) → QDataSet

increase the rank of a rank one dataset by adding join dimensions that repeat the lower rank elements.

Parameters

ds - a rank 1 dataset to provide values and properties
ds2 - dataset to provide rank and lengths.

Returns:

a dataset with the same geometry as ds2.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


increaseRank2

increaseRank2( QDataSet ds, QDataSet ds2 ) → QDataSet

increase the rank of a rank two dataset by adding join dimensions that repeat the lower rank elements.

Parameters

ds - a rank 2 dataset to provide values and properties
ds2 - dataset to provide rank and lengths.

Returns:

a dataset with the same geometry as ds2.

[search for examples] [view on GitHub] [view on old javadoc] [view source]