add mdarray_encode support; refactor ras array id handling