org.das2.qds.SubsetDataSet
Extracts a subset of the source dataset by using a rank 1 subset of indeces on each index.
applyIndex
applyIndex( int idim, QDataSet idx ) → void
apply the subset indexes to a given dimension. For example,
if a=[10,20,30,40] then applyIndex( 0, [1,2] ) would result in [20,30].
Parameters
idim -
idx - the rank 1 index list, for example from where on a rank 1 dataset.
Returns:
void (returns nothing)
search for examples
view on GitHub
view source
parseIndices
parseIndices( String spec, int dimlen ) → int
parse the string spec into a list of indices. The spec is a
comma-delineated list containing any combination of:
- index, with negative indices relative to the end.
- start:stop, with stop exclusive.
- start:stop:stride, incrementing stride elements, including negative.
- start-stopInclusive, where the trailing index is also included.
If the spec starts with ~, then these indices are removed. For example:
- ~5, remove the 5th index.
- ~15:20, remove the 5 indices starting at 15.
- ~-1, remove the last index.
Note if invert is present, then the indices cannot be reversed.
Parameters
spec -
dimlen, - the amount added to negative indices.
Returns:
the list of integers.
search for examples
view on GitHub
view source