How can I implement reclassification in SciDB?
i.e. each input array cell must be substituted by a value depending on which value range the input value falls into

all values between -1.0…-0.8 must be substituted by 0
all values between -0.7…-0.5 must be substituted by 1
and so on


Hi Raro,

There are several possibilities depending upon how you are mapping the inputs. What is your intent with input values in the range (-0.8, -0.7)?

  • If the ranges of input values are fixed width (of 0.2) for each new index mapping and the domain of your input is [-1.0, ∞) then you can use an apply to obtain a new attribute using an algebraic expression:
    apply(INPUT, new_index, floor(5 * (original_val + 1.0)))
    This works for
[-1.0, -0.8] --> 0,
(-0.8, 0.6] --> 1,
(-0.6, 0.4] --> 2,
* If you have a small number of variable width mapping indexes you can use `iif`
 In this case, I did not know how you wanted to handle (-0.7,-08), so I used `null`. This will also set each input value < -1.0 to also be null. 
apply(INPUT, index, iif(original_val>=-1.0 and original_val <= -0.8,
                        iif(original_val > -0.7 and original_val <= -0.5,

* If you have a large number of varying width mappings, then you might want to look at



Thank you for the detailed explanation of diverse options!