BUG: ensure percentile has same output structure as in 1.8

percentile returned scalars and lists of arrays in 1.8
adapt new percentile to return scalar and arrays with q dimension first
for compatibility.
Merge pull request #3769 from juliantaylor/percentile-compat

BUG: ensure percentile has same output structure as in 1.8