org.das2.qds.SemanticOps

Common expressions that apply semantics to QDataSet. Introduced to reduce a lot of repeated code, but also to make it clear where semantics are being applied.


bounds

bounds( QDataSet ds ) → QDataSet

return the bounds DS[ JOIN_0=x,y; BINS_1=min,maxInclusive ] of the datasets independent parameters. This is only implemented for:
rank 2 Tablesextent(X),extent(Y) and Z is not represented
rank 3 array of tablesextent(X),extent(Y) and Z is not represented
rank 1 Y(X)extent(X),extent(Y)
not for rank 2 bundle dataset
not for rank 1 bundle dataset
The zeroth dimension will be the physical dimension of the DEPEND_0 values. Or said another way:
bounds[0,0]= X minbounds[0,1] = X maxbounds.slice(0) is the extent of X
bounds[1,0]= Y minbounds[1,1] = Y maxbounds.slice(1) is the extent of Y

Parameters

ds - rank 2 dataset with BINS_1="min,maxInclusive"

Returns:

org.das2.qds.QDataSet

search for examples view on GitHub view source


cadenceCheck

cadenceCheck( QDataSet tds, QDataSet ds ) → QDataSet

return a dataset with 1's where the cadence following this measurement is acceptable, and 0's where there should be a break in the data. For example, here's some pseudocode:

   findex= Ops.interpolate( xds, x )
   cadenceCheck= cadenceCheck(xds)
   r= where( cadenceCheck[floor(findex)] eq 0 )
   x[r]= fill
Presently this just uses guessXTagWidth to get the cadence, but this may allow a future version to support mode changes. The result is a dataset with the same length, and the last element is always 1.

Parameters

tds - rank 1 dataset of length N.
ds - dataset dependent on tds and used to detect valid measurements, or null.

Returns:

dataset with length N

See Also:

Ops#valid which checks for fill and valid_min, valid_max. which checks for fill and valid_min, valid_max.


search for examples view on GitHub view source


checkPropertyType

checkPropertyType( String prop, Object value, boolean throwException ) → boolean

verify property types. For example, that UNITS is a org.das2.datum.Units, etc. Returns true for unrecognized property names (future expansion) and null. If throwException is true, then an IllegalArgumentException is thrown.

Parameters

prop - the property name, e.g. QDataSet.CADENCE
value - the candidate value for the property.
throwException - if true, throw descriptive exception instead of returning false.

Returns:

true if the property type is okay.

search for examples view on GitHub view source


doubleValue

doubleValue( Number value ) → Double

returns the Double value of the number, preserving null and NaN.

Parameters

value -

Returns:

java.lang.Double

search for examples view on GitHub view source


getComponentLabels

getComponentLabels( QDataSet ds ) → String

return the labels for a dataset where DEPEND_1 is a bundle dimension. Look for the BUNDLE_1.

Parameters

ds -

Returns:

java.lang.String[]

search for examples view on GitHub view source


getComponentNames

getComponentNames( QDataSet ds ) → String

return the labels for a bundle dataset. For a rank 2 bundle, this will be found in BUNDLE_1, or legacy ones may have nominal data for DEPEND_1. For a rank 1 bundle this will be BUNDLE_0.

Parameters

ds - rank 1 or rank 2 bundle.

Returns:

the column names.

search for examples view on GitHub view source


getDependentDataSet

getDependentDataSet( QDataSet ds ) → QDataSet

return the dataset that is dependent on others. For a bundle, we use DataSetOps.unbundleDefaultDataSet

Parameters

ds -

Returns:

org.das2.qds.QDataSet

search for examples view on GitHub view source


getLooseUnitsConverter

getLooseUnitsConverter( QDataSet src, QDataSet dst ) → UnitsConverter

returns the UnitsConverter, or IDENTITY if the converter cannot be found and one of the two units is dimensionless.

Parameters

src - the dataset from which we get the original units.
dst - the dataset from which we get the destination units.

Returns:

the UnitsConverter

search for examples view on GitHub view source


getPropertyType

getPropertyType( String prop ) → String

return the property type expected for the property.

Parameters

prop -

Returns:

QDataSet, String, Number, Units, or CacheTag

search for examples view on GitHub view source


getSimpleTableContaining

getSimpleTableContaining( QDataSet tds, Datum x, Datum y ) → QDataSet

return the first table of the bundle containing x and y

Parameters

tds -
x -
y -

Returns:

org.das2.qds.QDataSet

search for examples view on GitHub view source


getUnitsConverter

getUnitsConverter( QDataSet src, QDataSet dst ) → UnitsConverter

return the UnitsConverter that will convert data from src to the units of dst.

Parameters

src - the dataset from which we get the original units.
dst - the dataset from which we get the destination units.

Returns:

the UnitsConverter

search for examples view on GitHub view source


guessXTagWidth

guessXTagWidth( QDataSet ds, QDataSet yds ) → Datum

return a reasonable tag width to use, or null if one cannot be guessed.

Parameters

ds - the dataset containing data with a cadence.
yds - null or a dataset that may contain fill.

Returns:

org.das2.datum.Datum

search for examples view on GitHub view source


isBins

isBins( QDataSet ds ) → boolean

Test for bins scheme, where BINS_1 (or BINS_0) is set. This is where a two-element index is min, max. Note the BINS dimension must be the last index of the QDataSet.

Parameters

ds -

Returns:

boolean

search for examples view on GitHub view source


isBundle

isBundle( QDataSet ds ) → boolean

Test for bundle scheme. Returns true if the BUNDLE_1 is set.

Parameters

ds -

Returns:

true if the dataset is a bundle

search for examples view on GitHub view source


isJoin

isJoin( QDataSet ds ) → boolean

returns true if the dataset is rank 2 or greater with the first dimension a join dimension. Note this does not return true for implicit joins, where JOIN_0 is not set.

Parameters

ds -

Returns:

boolean

search for examples view on GitHub view source


isLegacyBundle

isLegacyBundle( QDataSet zds ) → boolean

See Ops.isLegacyBundle

Parameters

zds -

Returns:

boolean

search for examples view on GitHub view source


isMonotonic

isMonotonic( QDataSet ds ) → boolean

returns true if the dataset indicates that it is monotonically increasing. See DataSetUtil.isMonotonic.

Parameters

ds -

Returns:

boolean

search for examples view on GitHub view source


isRank1Bundle

isRank1Bundle( QDataSet ds ) → boolean

Returns:

boolean

search for examples view on GitHub view source


isRank2Waveform

isRank2Waveform( QDataSet fillDs ) → boolean

Test for rank 2 waveform dataset, where DEPEND_1 is offset from DEPEND_0, and the data is the waveform. DEPEND_1 must be at least 128 elements long. DEPEND_1 must not be dimensionless.

Parameters

fillDs -

Returns:

boolean

search for examples view on GitHub view source


isRank3JoinOfRank2Waveform

isRank3JoinOfRank2Waveform( QDataSet ds ) → boolean

Test for rank 3 dataset that is a join of rank 2 waveform datasets.

Parameters

ds -

Returns:

boolean

search for examples view on GitHub view source


isSimpleBundleDataSet

isSimpleBundleDataSet( QDataSet ds ) → boolean

returns true if the dataset is a bundle of rank 1 datasets. If no dependence is declared, it is assumed that the first one or two datasets are the independent datasets, and the last is the dependent.

    X,Y   -->  Y(X)
    X,Y,Z -->  Z(X,Y)

Parameters

ds -

Returns:

boolean

search for examples view on GitHub view source


isSimpleTableDataSet

isSimpleTableDataSet( QDataSet ds ) → boolean

returns true if the dataset is the scheme of a legacy TableDataSet with only one table. Note "Tables" have just one X unit and one Y unit, no bundles. Consider: rule about "duck typing": rules like !Ops.isBundle break this because it requires to be a simpleTable, you cannot be a bundle. LANL rich ASCII allows datasets to be both bundles and simple tables.

Parameters

ds -

Returns:

boolean

search for examples view on GitHub view source


isTableDataSet

isTableDataSet( QDataSet ds ) → boolean

returns true if the dataset is the scheme of a legacy TableDataSet

Parameters

ds -

Returns:

boolean

search for examples view on GitHub view source


isTimeSeries

isTimeSeries( QDataSet ds ) → boolean

returns true if the dataset is a time series. This is either something that has DEPEND_0 as a dataset with time location units, or a join of other datasets that are time series.

Parameters

ds -

Returns:

boolean

search for examples view on GitHub view source


lookupTimeLengthUnit

Deprecated: use Units.lookupTimeLengthUnit

lookupTimeUnits

Deprecated: use Units.lookupTimeUnits

lookupUnits

Deprecated: use Units.lookupUnits

weightsDataSet

weightsDataSet( QDataSet ds ) → QDataSet

return the weights dataset, possibly creating one based on VALID_MIN VALID_MAX and FILL_VALUE properties. The weights dataset will have value zero where the data is invalid, and a non-zero weight where it is valid. DataSets may also contain a weights table with relative weights, but this is not uniformly supported. Note: this uses QDataSet.WEIGHTS_PLANE Note: calls org.das2.qds.DataSetUtil.weightsDataSet.

Parameters

ds -

Returns:

QDataSet with same geometry containing zeros and non-zeros.

See Also:

org.das2.qds.ops.Ops#valid which is equivalent which is equivalent
cadenceCheck which detects for gaps in cadence. which detects for gaps in cadence.


search for examples view on GitHub view source


xtagsDataSet

xtagsDataSet( QDataSet ds ) → QDataSet

return the dataset containing the x tags for the dataset. This is QDataSet.DEPEND_0, or if that's null then IndexGenDataSet(ds.length). For a bundle, this is just the 0th dataset. For a join, this is a join of the xtags datasets of each dataset.

Parameters

ds -

Returns:

org.das2.qds.QDataSet

search for examples view on GitHub view source


ytagsDataSet

ytagsDataSet( QDataSet ds ) → QDataSet

return the ytags for the simple table that is ds.

TODO: consider that these break duck typing goal, and really need a scheme to tell it how to get the dataset.

Parameters

ds - the dataset

Returns:

the ytags

search for examples view on GitHub view source