Phase unwrapping for ndarrays