Illustrating four features in SciDB 14.8


#1

In SciDB 14.8, there are two unsupported features (they may be removed or changed in future releases without notice):
[ul]
[]An operator cross_between(srcArray, rangesArray): produces a result array by cutting out data from srcArray inside one of the rectangular ranges specified in rangesArray. Here rangesArray must have d2 attributes of type int64, where each record describes a rectangular range as low_1, …, low_d, high_1, …, high_d, where d is the number of dimensions in srcArray.[/]
[
]A system macro op_set_cell_attr_1D(a1Dim1AttrArray, dimName, dimCoord, attrName, attrValue): sets the value of the cell at dimCoord to be attrValue.[/*]
[/ul]

An example problem:
Builds a Src array which stores the squares of 0 to 9, builds a Ranges array which has two ranges [4…5] and [8…9], then cuts out the following data from Src array using cross_between:
{i} v
{4} 16
{5} 25
{8} 64
{9} 81

The queries:
iquery -aq "create array Src<v:int64>[i=0:9,5,0]"
iquery -aq "store(build(Src, i*i), Src)"
iquery -aq "create temp array RangesLowlow:int64[i=1:2,1,0]"
iquery -aq "op_set_cell_attr_1D(RangesLow, i, 1, low, 4)"
iquery -aq "op_set_cell_attr_1D(RangesLow, i, 2, low, 8)"
iquery -aq "store(apply(RangesLow, high, low+1), Ranges)"
iquery -aq "cross_between(Src, Ranges)"
remove_arrays.py -t

Some notes:
[ul]
[] The example illustrates a 14.8 feature called temp array: you use ‘create temp array’ instead ‘create array’. The temp arrays are faster than normal arrays because they are not persisent.[/]
[] The example illustrates a 14.8 feature called remove_arrays.py. You may use it to remove all or some of the arrays. The “-t” option means to remove only temp arrays (in this case RangesLow but not Src or Ranges). You may also provide a regular expression.[/]
[/ul]