simplified select_masked_array_elements