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:

a QDataSet

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


cadenceCheck

cadenceCheck( QDataSet tds, QDataSet ds ) → QDataSet

return a dataset with 1's where the cadence preceeding 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 zeroth 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 on old javadoc] [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 on old javadoc] [view source]


doubleValue

doubleValue( Number value ) → Double

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

Parameters

value - a Number

Returns:

a Double

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


getComponentLabels

getComponentLabels( QDataSet ds ) → String[]

return the labels for a dataset using BUNDLE_1 and DEPEND_1. If BUNDLE_1 is defined and contains a LABEL, then it is used, otherwise a string value of the data is used, supporting legacy bundles, and if no DEPEND_1 is found then use the NAME properties from the bundle, or "ch_i" for each channel.

Parameters

ds - the dataset, with a BUNDLE_1 or DEPEND_1 dimension which could be used.

Returns:

labels for each bundled dataset.

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [view source]


getDatum

getDatum( QDataSet ds, double d ) → Datum

returns the value as a datum. Note this should be used with reservation, this is not very efficient when the operation is done many times.

Parameters

ds - dataset providing the UNITS and VALID_MIN, VALID_MAX and FILL_VALUE.
d - the double.

Returns:

a datum representing the value.

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


getDependentDataSet

getDependentDataSet( QDataSet ds ) → QDataSet

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

Parameters

ds - a QDataSet

Returns:

a QDataSet

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


getLooseUnitsConverter

getLooseUnitsConverter( QDataSet src, QDataSet dst ) → org.das2.datum.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 on old javadoc] [view source]


getPlanarView

getPlanarView( QDataSet ds, String name ) → QDataSet

returns the plane requested by name, or null if it does not exist. If the name is PLANE_i, then return PLANE_i, otherwise return the dataset with this name. Note QDataSet has the rule that if PLANE_i is null, then all PLANE_(i+1) must also be null.

Parameters

ds - a QDataSet
name - a String

Returns:

a QDataSet

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


getPropertyType

getPropertyType( String prop ) → String

return the property type expected for the property.

Parameters

prop - a String

Returns:

QDataSet, String, Number, Units, or CacheTag

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


getSimpleTableContaining

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

return the first table of the bundle containing x and y

Parameters

tds - a QDataSet
x - a Datum
y - a Datum

Returns:

a QDataSet

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


getUnits

getUnits( QDataSet ds ) → Units

returns the units found in the UNITS property of the dataset, or Units.dimensionless if it is not found.

Parameters

ds - a QDataSet

Returns:

the units found in the dataset, or Units.dimensionless.

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


getUnitsConverter

getUnitsConverter( QDataSet src, QDataSet dst ) → org.das2.datum.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 on old javadoc] [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:

a Datum

[search for examples] [view on GitHub] [view on old javadoc] [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 - a QDataSet

Returns:

a boolean

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


isBundle

isBundle( QDataSet ds ) → boolean

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

Parameters

ds - a QDataSet

Returns:

true if the dataset is a bundle

[search for examples] [view on GitHub] [view on old javadoc] [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 - a QDataSet

Returns:

a boolean

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


isLegacyBundle

isLegacyBundle( QDataSet zds ) → boolean

See Ops.isLegacyBundle

Parameters

zds - a QDataSet

Returns:

a boolean

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


isMonotonic

isMonotonic( QDataSet ds ) → boolean

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

Parameters

ds - a QDataSet

Returns:

a boolean

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


isRank1Bundle

isRank1Bundle( QDataSet ds ) → boolean

returns true if the rank 1 dataset is a bundle of rank 0 datasets, or where DEPEND_0 is a labels dataset.

Parameters

ds - a dataset

Returns:

if rank 1 bundle or rank 1 having labels dataset for DEPEND_0.

[search for examples] [view on GitHub] [view on old javadoc] [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. Other rules include: